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

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_multimedia.c
  40.  *
  41.  * Project:
  42.  * --------
  43.  *  MAUI
  44.  *
  45.  * Description:
  46.  * ------------
  47.  *  Multimedia related categories.
  48.  *
  49.  *  [Category221]       Empty Screen
  50.  *  [Category222]       View Image Screen
  51.  *  [Category223]       Play Audio Screen
  52.  *  [Category224]       Play Video Full Screen
  53.  *  [Category225]       Play Video Standard Screen (With title & softkey)
  54.  *
  55.  *  [Category331][SUB]  Emptry Sublcd Screen
  56.  *  [Category332][SUB]  Image Icon Sublcd Screen 
  57.  *  [Category333][SUB]  Play Audio Sublcd Screen
  58.  *
  59.  * Author:
  60.  * -------
  61.  * -------
  62.  *
  63.  *============================================================================
  64.  *             HISTORY
  65.   * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!! 
  66.  *------------------------------------------------------------------------------
  67.  * removed!
  68.  *
  69.  * removed!
  70.  * removed!
  71.  * removed!
  72.  *
  73.  * removed!
  74.  * removed!
  75.  * removed!
  76.  *
  77.  * removed!
  78.  * removed!
  79.  * removed!
  80.  *
  81.  * removed!
  82.  * removed!
  83.  * removed!
  84.  *
  85.  * removed!
  86.  * removed!
  87.  * removed!
  88.  *
  89.  * removed!
  90.  * removed!
  91.  * removed!
  92.  *
  93.  * removed!
  94.  * removed!
  95.  * removed!
  96.  *
  97.  * removed!
  98.  * removed!
  99.  * removed!
  100.  *
  101.  * removed!
  102.  * removed!
  103.  * removed!
  104.  *
  105.  * removed!
  106.  * removed!
  107.  * removed!
  108.  *
  109.  * removed!
  110.  * removed!
  111.  * removed!
  112.  *
  113.  * removed!
  114.  * removed!
  115.  * removed!
  116.  *
  117.  * removed!
  118.  * removed!
  119.  * removed!
  120.  *
  121.  * removed!
  122.  * removed!
  123.  * removed!
  124.  *
  125.  * removed!
  126.  * removed!
  127.  * removed!
  128.  *
  129.  * removed!
  130.  * removed!
  131.  * removed!
  132.  *
  133.  * removed!
  134.  * removed!
  135.  * removed!
  136.  *
  137.  * removed!
  138.  * removed!
  139.  * removed!
  140.  *
  141.  * removed!
  142.  * removed!
  143.  * removed!
  144.  *
  145.  * removed!
  146.  * removed!
  147.  * removed!
  148.  *
  149.  * removed!
  150.  * removed!
  151.  * removed!
  152.  *
  153.  * removed!
  154.  * removed!
  155.  * removed!
  156.  *
  157.  * removed!
  158.  * removed!
  159.  * removed!
  160.  *
  161.  * removed!
  162.  * removed!
  163.  * removed!
  164.  *
  165.  * removed!
  166.  * removed!
  167.  * removed!
  168.  *
  169.  * removed!
  170.  * removed!
  171.  * removed!
  172.  *
  173.  * removed!
  174.  * removed!
  175.  * removed!
  176.  *
  177.  * removed!
  178.  * removed!
  179.  * removed!
  180.  *
  181.  * removed!
  182.  * removed!
  183.  * removed!
  184.  *
  185.  * removed!
  186.  * removed!
  187.  * removed!
  188.  *
  189.  * removed!
  190.  * removed!
  191.  * removed!
  192.  *
  193.  * removed!
  194.  * removed!
  195.  * removed!
  196.  *
  197.  * removed!
  198.  * removed!
  199.  * removed!
  200.  *
  201.  * removed!
  202.  * removed!
  203.  * removed!
  204.  *
  205.  * removed!
  206.  * removed!
  207.  * removed!
  208.  *
  209.  * removed!
  210.  * removed!
  211.  * removed!
  212.  *
  213.  * removed!
  214.  * removed!
  215.  * removed!
  216.  *
  217.  * removed!
  218.  * removed!
  219.  * removed!
  220.  *
  221.  * removed!
  222.  * removed!
  223.  * removed!
  224.  *
  225.  * removed!
  226.  * removed!
  227.  * removed!
  228.  *
  229.  * removed!
  230.  * removed!
  231.  * removed!
  232.  *
  233.  * removed!
  234.  * removed!
  235.  * removed!
  236.  *
  237.  * removed!
  238.  * removed!
  239.  * removed!
  240.  *
  241.  * removed!
  242.  * removed!
  243.  * removed!
  244.  *
  245.  * removed!
  246.  * removed!
  247.  * removed!
  248.  *
  249.  * removed!
  250.  * removed!
  251.  * removed!
  252.  *
  253.  * removed!
  254.  * removed!
  255.  * removed!
  256.  *
  257.  * removed!
  258.  * removed!
  259.  * removed!
  260.  *
  261.  * removed!
  262.  * removed!
  263.  * removed!
  264.  *
  265.  * removed!
  266.  * removed!
  267.  * removed!
  268.  *
  269.  * removed!
  270.  * removed!
  271.  * removed!
  272.  *
  273.  * removed!
  274.  * removed!
  275.  * removed!
  276.  *
  277.  * removed!
  278.  * removed!
  279.  * removed!
  280.  *
  281.  * removed!
  282.  * removed!
  283.  * removed!
  284.  *
  285.  * removed!
  286.  * removed!
  287.  * removed!
  288.  *
  289.  * removed!
  290.  * removed!
  291.  * removed!
  292.  *
  293.  * removed!
  294.  * removed!
  295.  * removed!
  296.  *
  297.  * removed!
  298.  * removed!
  299.  * removed!
  300.  *
  301.  * removed!
  302.  * removed!
  303.  * removed!
  304.  *
  305.  * removed!
  306.  * removed!
  307.  * removed!
  308.  *
  309.  * removed!
  310.  * removed!
  311.  * removed!
  312.  *
  313.  * removed!
  314.  * removed!
  315.  * removed!
  316.  *
  317.  * removed!
  318.  * removed!
  319.  * removed!
  320.  *
  321.  * removed!
  322.  * removed!
  323.  * removed!
  324.  *
  325.  * removed!
  326.  * removed!
  327.  * removed!
  328.  *
  329.  * removed!
  330.  * removed!
  331.  * removed!
  332.  *
  333.  * removed!
  334.  * removed!
  335.  * removed!
  336.  *
  337.  * removed!
  338.  * removed!
  339.  * removed!
  340.  *
  341.  * removed!
  342.  * removed!
  343.  * removed!
  344.  *
  345.  * removed!
  346.  * removed!
  347.  * removed!
  348.  *
  349.  * removed!
  350.  * removed!
  351.  * removed!
  352.  *
  353.  * removed!
  354.  * removed!
  355.  * removed!
  356.  *
  357.  * removed!
  358.  * removed!
  359.  * removed!
  360.  *
  361.  * removed!
  362.  * removed!
  363.  * removed!
  364.  *
  365.  * removed!
  366.  * removed!
  367.  * removed!
  368.  *
  369.  * removed!
  370.  * removed!
  371.  * removed!
  372.  *
  373.  * removed!
  374.  * removed!
  375.  * removed!
  376.  *
  377.  * removed!
  378.  * removed!
  379.  * removed!
  380.  *
  381.  * removed!
  382.  * removed!
  383.  * removed!
  384.  *
  385.  * removed!
  386.  * removed!
  387.  * removed!
  388.  *
  389.  * removed!
  390.  * removed!
  391.  * removed!
  392.  *
  393.  * removed!
  394.  * removed!
  395.  * removed!
  396.  *
  397.  * removed!
  398.  * removed!
  399.  * removed!
  400.  *
  401.  * removed!
  402.  * removed!
  403.  * removed!
  404.  *
  405.  *------------------------------------------------------------------------------
  406.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  407.  *============================================================================
  408.  ****************************************************************************/
  409. #ifndef MMI_ON_HARDWARE_P
  410. #undef __DRM_SUPPORT__
  411. #undef __DRM_V01__
  412. #endif /* MMI_ON_HARDWARE_P */ 
  413. /* cat 222 profiling */
  414. // #define CAT222_DECODE_TIME_TEST
  415. #include "MMI_features.h"
  416. #include "stdC.h"
  417. #include "L4Dr1.h"
  418. #include "PixtelDataTypes.h"
  419. /* framework related include */
  420. #include "EventsGprot.h"
  421. #include "CustDataProts.h"
  422. #include "CustMenuRes.h"
  423. #include "GlobalDefs.h"
  424. #include "FrameworkStruct.h"
  425. #include "EventsDef.h"
  426. #include "Unicodexdcl.h"
  427. #include "DebugInitDef.h"
  428. #include "fat_fs.h"
  429. #include "SettingProfile.h"     /* for error tone */
  430. #ifdef __DRM_SUPPORT__
  431. #include "Fs_errcode.h"
  432. #include "Drm_gprot.h"
  433. #endif /* __DRM_SUPPORT__ */ 
  434. /* gui related include */
  435. #include "gdi_include.h"        /* include for graphic lib */
  436. #include "lcd_if.h"
  437. #include "gui_themes.h"
  438. #include "wgui.h"
  439. #include "wgui_softkeys.h"
  440. #include "wgui_fixed_menus.h"
  441. #include "wgui_fixed_menuitems.h"
  442. #include "wgui_dynamic_menus.h"
  443. #include "wgui_dynamic_menuitems.h"
  444. #include "wgui_categories.h"
  445. #include "wgui_categories_sublcd.h"
  446. #include "wgui_categories_multimedia.h"
  447. #include "wgui_categories_inputs.h"     /* MULTILINE_INPUTBOX_HEIGHT_PAD */
  448. #include "wgui_status_icons.h"
  449. #include "CommonScreens.h"      /* DisplayPopup() */
  450. #include "PhoneSetupGprots.h"   /* PhnsetGetDefEncodingType() */
  451. #include "Conversions.h"        /* char set conversion */
  452. #include "ScrMemMgrGprot.h"     /* screen memeory manager */
  453. #include "wgui_draw_manager.h"
  454. #ifdef __MMI_TOUCH_SCREEN__
  455. #include "wgui_touch_screen.h"
  456. #endif 
  457. #include "WallpaperDefs.h"      /* Image size error string */
  458. #include "GpioInc.h"    /* backlight on/off */
  459. #include "FileMgr.h"
  460. #include "FileManagerDef.h"
  461. #include "FileManagerGProt.h"
  462. #include "SubLCDHistoryGprot.h" /* sublcd function */
  463. #ifdef CAT222_DECODE_TIME_TEST
  464. #include "kal_release.h"        /* for KAL time API */
  465. #include "kal_nucleus.h"
  466. #endif /* CAT222_DECODE_TIME_TEST */ 
  467. #ifdef __MMI_VIDEO_PLAYER__
  468. #include "med_api.h"    /* media task */
  469. #include "med_main.h"   /* media task */
  470. #include "mdi_datatype.h"
  471. #include "mdi_video.h"  /* video lib */
  472. #include "mdi_audio.h"
  473. #include "lcd_sw_rnd.h"
  474. #include "gdi_include.h"
  475. #include "VdoPlyImgEnum.h"      /* sublcd video icon */
  476. #endif /* __MMI_VIDEO_PLAYER__ */ 
  477. #ifdef __MMI_TVOUT__
  478. #include "mdi_tv.h"     /* mdi tvout */
  479. #include "WallpaperDefs.h"      /* some header for phonsetup.h */
  480. #include "DownloadDefs.h"       /* some header for phonsetup.h */
  481. #include "PhoneSetup.h" /* tvout display style */
  482. #endif /* __MMI_TVOUT__ */ 
  483. #ifdef __MMI_SWFLASH__
  484. #include "mdi_swflash.h"
  485. #include "mmi_phnset_dispchar.h"
  486. #endif 
  487. /****************************************************************************
  488. * Define
  489. *****************************************************************************/
  490. /****************************************************************************
  491. * Global Variable
  492. *****************************************************************************/
  493. extern S16 status_icon;
  494. extern S32 wgui_image_clip_x1;
  495. extern S32 wgui_image_clip_x2;
  496. extern S32 wgui_image_clip_y1;
  497. extern S32 wgui_image_clip_y2;
  498. extern U8 wgui_category_screen_no_buttons;
  499. extern BOOL r2lMMIFlag;
  500. extern U16 title_bg_id;
  501. extern gdi_handle wgui_layer_1;
  502. extern gdi_handle wgui_base_layer;
  503. #ifdef __MMI_SWFLASH__
  504. extern S8 *idle_screen_wallpaper_name;
  505. #endif
  506. /****************************************************************************
  507. * Global Function
  508. *****************************************************************************/
  509. extern void wgui_set_animation_image_y(S32 x, S32 y, PU8 img);
  510. extern void wgui_show_transparent_animation(void);
  511. extern void set_main_LCD_time_duration_hide_function(void (*f) (S32 x1, S32 y1, S32 x2, S32 y2));       /* 101705 */
  512. #ifdef __MMI_AUDIO_PLAYER__
  513. extern int mmi_audply_exit_subLCD(void);
  514. extern int mmi_audply_redraw_subLCD(BOOL);
  515. extern BOOL mmi_audply_is_playing(void);
  516. #endif /* __MMI_AUDIO_PLAYER__ */ 
  517. #ifdef __MMI_FM_RADIO__
  518. extern int mmi_fmrdo_exit_subLCD(void);
  519. extern int mmi_fmrdo_redraw_subLCD(BOOL);
  520. extern BOOL mmi_fmrdo_is_power_on(void);
  521. #endif /* __MMI_FM_RADIO__ */ 
  522. #ifdef __MMI_VIDEO_PLAYER__
  523. mdi_video_info_struct wgui_video_info;
  524. #endif 
  525. #ifdef __MMI_SWFLASH__
  526. extern void PhnsetWallpaperBadFileCallBack(U16 imgID);
  527. extern void dm_category_33_controlled_area(dm_coordinates *coordinate);
  528. extern pBOOL mmi_bootup_get_active_flight_mode(void);
  529. extern void ShowCategory33Screen_ext(
  530.                 U16 left_softkey,
  531.                 U16 left_softkey_icon,
  532.                 U16 right_softkey,
  533.                 U16 right_softkey_icon,
  534.                 U8 *history_buffer);
  535. extern void ExitCategory33Screen(void);
  536. #endif 
  537. /****************************************************************************
  538. * Local Variable
  539. *****************************************************************************/
  540. /* [Category 221] */
  541. static FuncPtr cat221_redraw_content_callback = NULL;
  542. static gdi_color cat221_background_color;
  543. /* [Category 222] */
  544. static PS8 cat222_file_name_ptr;
  545. static U16 cat222_title_icon;
  546. static U16 cat222_title;
  547. static PS8 cat222_button_str_ptr;   /* will use subMenu's data buffer to store */
  548. static void (*cat222_decode_result_callback) (GDI_RESULT);
  549. static BOOL cat222_is_short_filename;
  550. static GDI_HANDLE cat222_anim_handle;
  551. static S32 cat222_img_width;
  552. static S32 cat222_img_height;
  553. #ifdef __MMI_TVOUT__
  554. static BOOL cat222_is_fullscr_tvout = FALSE;
  555. #endif 
  556. /* [Category 223] */
  557. static BOOL cat223_display_duration = FALSE;
  558. /* [Category Vdoply] */
  559. #ifdef __MMI_VIDEO_PLAYER__
  560. static U16 cat_vdoply_video_repeat_count;
  561. static U8 cat_vdoply_audio_volumn;
  562. static BOOL cat_vdoply_video_is_visual_update;
  563. static BOOL cat_vdoply_video_is_play_audio;
  564. static BOOL cat_vdoply_video_is_lcd_no_sleep;
  565. static BOOL cat_vdoply_is_video_open;
  566. static BOOL cat_vdoply_is_video_play;
  567. static MDI_RESULT cat_vdoply_is_video_play_result = -1;
  568. static BOOL cat_vdoply_is_video_force_stop; /* force stop flag */
  569. static BOOL cat_vdoply_is_video_from_id;
  570. static GDI_HANDLE cat_vdoply_video_layer = GDI_ERROR_HANDLE;
  571. #ifdef __MMI_SUBLCD__
  572. static BOOL cat_vdoply_is_sublcd_display = FALSE;   /* must init */
  573. #endif 
  574. static void (*cat_vdoply_play_finish_callback) (MDI_RESULT result);
  575. static U8 cat_vdoply_is_full_screen;
  576. #endif /* __MMI_VIDEO_PLAYER__ */ 
  577. /* [Category 229 ] */
  578. #ifdef __MMI_SWFLASH__
  579. extern mdi_swflash_info_struct wgui_swflash_info;
  580. static U16 cat_swflash_repeat_count;
  581. static U8 cat_swflash_audio_volumn;
  582. static MMI_BOOL cat_swflash_is_audio_on;
  583. static MMI_BOOL cat_swflash_is_vibrate_on;
  584. static MMI_BOOL cat_swflash_is_interaction_on;
  585. static MMI_BOOL cat_swflash_is_lcd_no_sleep;
  586. static MMI_BOOL cat_swflash_is_open;
  587. static MMI_BOOL cat_swflash_is_play;
  588. static MMI_BOOL cat_swflash_is_from_id;
  589. static GDI_HANDLE cat_swflash_layer = GDI_ERROR_HANDLE;
  590. static void (*cat_swflash_play_finish_callback) (MDI_RESULT);
  591. static U8 cat_swflash_is_full_screen;
  592. static MDI_RESULT cat_swflash_play_ret;
  593. #endif /* __MMI_SWFLASH__ */ 
  594. #ifdef __MMI_SWFLASH__
  595. static S32 g_mmi_idle_bg_media_type = 0;
  596. #endif
  597. /****************************************************************************
  598. * Local Function
  599. *****************************************************************************/
  600. /* [Category 221] */
  601. static void ExitCategory221Screen(void);
  602. /* [Category 222] */
  603. static void ExitCategory222Screen(void);
  604. static void Cat222DecodeImage(void);
  605. static void Cat222DrawTitle(void);
  606. #ifdef __MMI_TVOUT__
  607. static void Cat222ToggleTVDisplay(void);
  608. #endif 
  609. /* [Category 223] */
  610. static void ExitCategory223Screen(void);
  611. static void DrawCate223CategoryControlArea(dm_coordinates *coordinate);
  612. static void Cat223DrawDurationBar(void);
  613. static void Cat223InitDruration(UI_time *t, U32 duration);
  614. static void Cat223HideDurationDisplay(S32 x1, S32 y1, S32 x2, S32 y2);
  615. #ifdef __MMI_VIDEO_PLAYER__
  616.    /* [Category Video Play Screen] */
  617. static void ShowCategoryVdoplyScreen(BOOL is_fullscreen,
  618.                                      U16 title_str,
  619.                                      U16 title_icon,
  620.                                      U16 lsk_str,
  621.                                      U16 lsk_icon,
  622.                                      U16 rsk_str,
  623.                                      U16 rsk_icon,
  624.                                      U16 video_id,
  625.                                      PS8 video_filename,
  626.                                      U16 repeat_count,
  627.                                      BOOL is_visual_update,
  628.                                      BOOL is_play_audio,
  629.                                      BOOL is_lcd_no_sleep,
  630.                                      GDI_COLOR bg_color, void (*play_finish_callback) (MDI_RESULT), void *gui_buffer);
  631. static void ExitCategoryVdoplyScreen(void);
  632. static void StopCategoryVdoplyVideo(void);
  633. static void PauseCategoryVdoplyVideo(void);
  634. static void ResumeCategoryVdoplyVideo(void);
  635. static void CatVdoplyPlayFinishCallback(MDI_RESULT result);
  636. #ifdef __MMI_SWFLASH__
  637. extern void DrawCateSWFlashCategoryControlArea(dm_coordinates *coordinate);
  638. extern void ExitCategory34Screen(void);
  639. #endif
  640. #ifdef __MMI_SUBLCD__
  641. static void EnterCategoryVdoplySubScreen(void);
  642. static void ExitCategoryVdoplySubScreen(void);
  643. #endif /* __MMI_SUBLCD__ */ 
  644. static void CatVdoplyVolUp(void);
  645. static void CatVdoplyVolDown(void);
  646. #endif /* __MMI_VIDEO_PLAYER__ */ 
  647. #ifdef __MMI_SUBLCD__
  648. /* [Category 331] [SUB] */
  649. static void ExitCategory331Screen(void);
  650. /* [Category 331] [SUB] */
  651. static void ExitCategory332Screen(void);
  652. /* [Category 333] [SUB] */
  653. static U8 *GetCategory333History(U8 *history_buffer);
  654. static S32 GetCategory333HistorySize(void);
  655. static void ExitCategory333Screen(void);
  656. static void RedrawCategory333Screen(void);
  657. #endif /* __MMI_SUBLCD__ */ 
  658. void cat226_hide_button_full_screen(void *button_object);
  659. #ifdef __MMI_SWFLASH__
  660. static void ExitCategorySWFlashScreen(void);
  661. #endif
  662. /****************************************************************************
  663. *
  664. * MultiMedia Related [MainLCD] Categories
  665. *
  666. *****************************************************************************/
  667. /*****************************************************************************
  668. * [Category221]
  669. *
  670. * This category is basic frame with caption and softkeys.
  671. *
  672. *  **********************
  673. *  *       Caption      *
  674. *  **********************
  675. *  *                    *
  676. *  *                    *
  677. *  *                    *
  678. *  *                 <----------- Empty. Will hook call back function to redraw.
  679. *  *                    *
  680. *  *                    *
  681. *  *                    *
  682. *  *********    *********
  683. *  *  LSK  *    *  RSK  *
  684. *  **********************
  685. *
  686. *****************************************************************************/
  687. /*****************************************************************************
  688.  * FUNCTION
  689.  *  DrawCate221CategoryControlArea
  690.  * DESCRIPTION
  691.  *  This function is used to draw the category controlled area of category221 screen
  692.  * PARAMETERS
  693.  *  coordinate      [IN/OUT]        Coordinates of category controlled area.
  694.  * RETURNS
  695.  *  void
  696.  *****************************************************************************/
  697. void DrawCate221CategoryControlArea(dm_coordinates *coordinate)
  698. {
  699.     /*----------------------------------------------------------------*/
  700.     /* Local Variables                                                */
  701.     /*----------------------------------------------------------------*/
  702.     /*----------------------------------------------------------------*/
  703.     /* Code Body                                                      */
  704.     /*----------------------------------------------------------------*/
  705.     if (MMI_title_string != 0 || MMI_title_icon != 0)
  706.     {
  707.     #if defined(__MMI_SCREEN_ROTATE__)
  708.         if (!mmi_frm_is_screen_width_height_swapped())
  709.         {
  710.             show_title_status_icon();
  711.         }
  712.     #else /* defined(__MMI_SCREEN_ROTATE__) */ 
  713.         show_title_status_icon();
  714.     #endif /* defined(__MMI_SCREEN_ROTATE__) */ 
  715.         draw_title();
  716.     }
  717.     /* fill background */
  718.     gdi_layer_reset_clip();
  719.     /* if has title - draw content region only */
  720.     if (MMI_title_string != 0 || MMI_title_icon != 0)
  721.     {
  722.         gdi_draw_solid_rect(
  723.             0,
  724.             (MMI_title_y + MMI_title_height),
  725.             UI_device_width - 1,
  726.             (MMI_title_y + MMI_title_height) + MMI_content_height - 1,
  727.             cat221_background_color);
  728.     }
  729.     else
  730.     {
  731.         gdi_draw_solid_rect(
  732.             0,
  733.             0,
  734.             UI_device_width - 1,
  735.             (MMI_title_y + MMI_title_height) + MMI_content_height - 1,
  736.             cat221_background_color);
  737.     }
  738.     /* redraw callback function */
  739.     if (cat221_redraw_content_callback != NULL)
  740.     {
  741.         cat221_redraw_content_callback();
  742.     }
  743. }
  744. /*****************************************************************************
  745.  * FUNCTION
  746.  *  ShowCategory221Screen
  747.  * DESCRIPTION
  748.  *  Show category 221 screen.
  749.  * PARAMETERS
  750.  *  title                       [IN]        Title string id
  751.  *  title_icon                  [IN]        Title image id
  752.  *  left_softkey                [IN]        Lsk string id
  753.  *  left_softkey_icon           [IN]        Lsk image id
  754.  *  right_softkey               [IN]        Rsk string id
  755.  *  right_softkey_icon          [IN]        Rsk image id
  756.  *  background_color            [IN]        Background color for content region
  757.  *  redraw_content_callback     [IN]        Callback function to redraw context (PS.This redraw callback pointer is used for framework to update content region when theme update.PS. MMI Framework will not call redraw function anymore. The pointer is useless)
  758.  * RETURNS
  759.  *  void
  760.  *****************************************************************************/
  761. void ShowCategory221Screen(
  762.         U16 title,
  763.         U16 title_icon,
  764.         U16 left_softkey,
  765.         U16 left_softkey_icon,
  766.         U16 right_softkey,
  767.         U16 right_softkey_icon,
  768.         gdi_color background_color,
  769.         FuncPtr redraw_content_callback)
  770. {
  771.     /*----------------------------------------------------------------*/
  772.     /* Local Variables                                                */
  773.     /*----------------------------------------------------------------*/
  774.     /*----------------------------------------------------------------*/
  775.     /* Code Body                                                      */
  776.     /*----------------------------------------------------------------*/
  777.     dm_data_struct dm_data;
  778.     cat221_background_color = background_color;
  779.     cat221_redraw_content_callback = redraw_content_callback;
  780.     /* hide status if will not draw title bar */
  781. #if defined(__MMI_MAINLCD_176X220__) || defined (__MMI_MAINLCD_240X320__)       /* 041205 Calvin modieid */
  782.     if (title == 0 && title_icon == 0)
  783.     {
  784.         hide_status_icon_bar(0);
  785.     }
  786. #endif /* defined(__MMI_MAINLCD_176X220__) || defined (__MMI_MAINLCD_240X320__) */ 
  787.     /* lock */
  788.     gui_lock_double_buffer();
  789.     MMI_menu_shortcut_number = -1;
  790.     change_left_softkey(left_softkey, left_softkey_icon);
  791.     change_right_softkey(right_softkey, right_softkey_icon);
  792.     SetupCategoryKeyHandlers();
  793.     /* init title */
  794.     MMI_title_string = (UI_string_type) get_string(title);
  795.     MMI_title_icon = (PU8) get_image(title_icon);
  796.     gui_unlock_double_buffer();
  797.     ExitCategoryFunction = ExitCategory221Screen;
  798.     dm_setup_category_functions(dm_redraw_category_screen, dm_get_category_history, dm_get_category_history_size);
  799.     dm_register_category_controlled_callback(DrawCate221CategoryControlArea);
  800.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  801.     dm_data.s32CatId = MMI_CATEGORY221_ID;
  802.     dm_data.s32flags = 0;
  803.     dm_setup_data(&dm_data);
  804.     dm_redraw_category_screen();
  805. }
  806. /*****************************************************************************
  807.  * FUNCTION
  808.  *  ExitCategory221Screen
  809.  * DESCRIPTION
  810.  *  Exit category 221
  811.  * PARAMETERS
  812.  *  void
  813.  * RETURNS
  814.  *  void
  815.  *****************************************************************************/
  816. static void ExitCategory221Screen(void)
  817. {
  818.     /*----------------------------------------------------------------*/
  819.     /* Local Variables                                                */
  820.     /*----------------------------------------------------------------*/
  821.     /*----------------------------------------------------------------*/
  822.     /* Code Body                                                      */
  823.     /*----------------------------------------------------------------*/
  824.     ClearHighlightHandler();
  825.     reset_softkeys();
  826. #if defined(__MMI_MAINLCD_176X220__) || defined (__MMI_MAINLCD_240X320__)       /* 041205 Calvin modieid */
  827.     show_status_icon_bar(0);
  828. #endif 
  829.     ExitCategoryFunction = MMI_dummy_function;
  830.     RedrawCategoryFunction = MMI_dummy_function;
  831.     GetCategoryHistory = dummy_get_history;
  832.     GetCategoryHistorySize = dummy_get_history_size;
  833. }
  834. /*****************************************************************************
  835. * [Category222]
  836. *
  837. * This category is for view image from file.
  838. *
  839. *  **********************
  840. *  *       Caption      *
  841. *  **********************
  842. *  *                    *
  843. *  *                    *
  844. *  *                    *
  845. *  *       (Image)      *
  846. *  *                    *
  847. *  *                    *
  848. *  *                    *
  849. *  *********    *********
  850. *  *  LSK  *    *  RSK  *
  851. *  **********************
  852. *
  853. *****************************************************************************/
  854. /****************************************************************************
  855. * Two View Mode. Turn on ONLY one style.
  856. * (1) CAT222_IMAGE_FIT_FULLSCREEN_SIZE.
  857. *     Image will fit full screen size. This is useful when view wallpapre that it will not shink.
  858. *
  859. * (2) CAT222_IMAGE_FIT_CONTENT_SIZE
  860. *     Image will fit content region, and will have a photo like display.
  861. *****************************************************************************/
  862. #if defined(__MMI_MAINLCD_176X220__) || defined (__MMI_MAINLCD_240X320__)       /* 041205 Calvin modieid */
  863. // #define      CAT222_IMAGE_FIT_FULLSCREEN_SIZE
  864. #define     CAT222_IMAGE_FIT_CONTENT_SIZE
  865. #define     CAT222_IMAGE_SPACING    (5) /* spacing between image and LCM boundry */
  866. #else /* defined(__MMI_MAINLCD_176X220__) || defined (__MMI_MAINLCD_240X320__) */ 
  867. // #define      CAT222_IMAGE_FIT_FULLSCREEN_SIZE
  868. #define     CAT222_IMAGE_FIT_CONTENT_SIZE
  869. #define     CAT222_IMAGE_SPACING    (4) /* spacing between image and LCM boundry */
  870. #endif /* defined(__MMI_MAINLCD_176X220__) || defined (__MMI_MAINLCD_240X320__) */ 
  871. void DrawCate222CategoryControlArea(dm_coordinates *coordinate);
  872. /*****************************************************************************
  873.  * FUNCTION
  874.  *  cat222_get_image_handle
  875.  * DESCRIPTION
  876.  *  get the animation handle for cat 222
  877.  * PARAMETERS
  878.  *  void
  879.  * RETURNS
  880.  *  gdi_handle
  881.  *****************************************************************************/
  882. gdi_handle cat222_get_image_handle(void)//070706
  883. {
  884.     return (gdi_handle)cat222_anim_handle;
  885. }
  886. /*****************************************************************************
  887.  * FUNCTION
  888.  *  ShowCategory222Screen
  889.  * DESCRIPTION
  890.  *  Show Category 222 Screen.
  891.  * PARAMETERS
  892.  *  title                       [IN]        )
  893.  *  title_icon                  [IN]        Title image id
  894.  *  left_softkey                [IN]        Lsk string id
  895.  *  left_softkey_icon           [IN]        Lsk image id
  896.  *  right_softkey               [IN]        Rsk string id
  897.  *  right_softkey_icon          [IN]        Rsk image id
  898.  *  background_color            [IN]        Background color for content region
  899.  *  button_string               [IN]        String on LSK region. (If this pointer is not NULL, the string will draw on lsk region.)
  900.  *  file_name_ptr               [IN]        Filename to be decode.
  901.  *  is_short_filename           [IN]        File name is short or not.
  902.  *  decode_result_callback      [IN]        Decode result callback function
  903.  *  EX: It may be used as show index/total number.(?)
  904.  * RETURNS
  905.  *  void
  906.  *****************************************************************************/
  907. void ShowCategory222Screen(
  908.         U16 title,
  909.         U16 title_icon,
  910.         U16 left_softkey,
  911.         U16 left_softkey_icon,
  912.         U16 right_softkey,
  913.         U16 right_softkey_icon,
  914.         gdi_color background_color,
  915.         S8 *button_string,
  916.         S8 *file_name_ptr,
  917.         BOOL is_short_filename,
  918.         void (*decode_result_callback) (GDI_RESULT))
  919. {
  920.     /*----------------------------------------------------------------*/
  921.     /* Local Variables                                                */
  922.     /*----------------------------------------------------------------*/
  923.     dm_data_struct dm_data;
  924.     /*----------------------------------------------------------------*/
  925.     /* Code Body                                                      */
  926.     /*----------------------------------------------------------------*/
  927.     cat222_file_name_ptr = file_name_ptr;
  928.     cat222_title_icon = title_icon;
  929.     cat222_title = title;
  930.     cat222_is_short_filename = is_short_filename;
  931.     cat222_decode_result_callback = decode_result_callback;
  932.     cat222_anim_handle = GDI_NULL_HANDLE;
  933.     if (button_string != NULL)
  934.     {
  935.         cat222_button_str_ptr = (S8*) (subMenuDataPtrs[0]); /* use submenu's data buffer, not a good solution */
  936.         memset(cat222_button_str_ptr, 0, MAX_SUB_MENU_SIZE);
  937.         pfnUnicodeStrncpy(cat222_button_str_ptr, button_string, (MAX_SUB_MENU_SIZE / ENCODING_LENGTH) - 1);
  938.     }
  939.     else
  940.     {
  941.         cat222_button_str_ptr = NULL;
  942.     }
  943.     MMI_menu_shortcut_number = -1;
  944.     change_left_softkey(left_softkey, left_softkey_icon);
  945.     change_right_softkey(right_softkey, right_softkey_icon);
  946.     SetupCategoryKeyHandlers();
  947. #ifdef __MMI_TVOUT__
  948.     SetKeyHandler(Cat222ToggleTVDisplay, KEY_STAR, KEY_EVENT_UP);
  949. #endif 
  950.     MMI_title_string = (UI_string_type) get_string(title);
  951.     MMI_title_icon = (PU8) get_image(title_icon);
  952.     ExitCategoryFunction = ExitCategory222Screen;
  953.     dm_setup_category_functions(UI_dummy_function, dm_get_category_history, dm_get_category_history_size);
  954.     dm_register_category_controlled_callback(DrawCate222CategoryControlArea);
  955.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  956.     dm_data.s32CatId = MMI_CATEGORY222_ID;
  957.     dm_data.s32flags = DM_CLEAR_SCREEN_BACKGROUND | DM_NO_BLT;
  958.     dm_setup_data(&dm_data);
  959.     dm_redraw_category_screen();
  960.     /* Draw Image */
  961.     Cat222DecodeImage();
  962. }
  963. /*****************************************************************************
  964.  * FUNCTION
  965.  *  ExitCategory222Screen
  966.  * DESCRIPTION
  967.  *  Exit Category 222 screen
  968.  * PARAMETERS
  969.  *  void
  970.  * RETURNS
  971.  *  void
  972.  *****************************************************************************/
  973. static void ExitCategory222Screen(void)
  974. {
  975.     /*----------------------------------------------------------------*/
  976.     /* Local Variables                                                */
  977.     /*----------------------------------------------------------------*/
  978.     /*----------------------------------------------------------------*/
  979.     /* Code Body                                                      */
  980.     /*----------------------------------------------------------------*/
  981.     /* restore TV out mode */
  982. #ifdef __MMI_TVOUT__
  983.     if (cat222_is_fullscr_tvout)
  984.     {
  985.         if (mdi_tvout_is_enable())
  986.         {
  987.             /* restore back to GDI */
  988.             mdi_tvout_set_owner(MDI_TV_OWNER_GDI);
  989.             /* restore back to start mode1 */
  990.             mdi_tvout_set_mode(
  991.                 MDI_TV_MODE_LCD_SCR,
  992.                 0,  /* layer_width */
  993.                 0); /* layer_height */
  994.         }
  995.     }
  996. #endif /* __MMI_TVOUT__ */ 
  997.     if (cat222_anim_handle != GDI_NULL_HANDLE)
  998.     {
  999.         gdi_image_stop_animation(cat222_anim_handle);
  1000.     }
  1001.     ClearHighlightHandler();
  1002.     reset_softkeys();
  1003.     ExitCategoryFunction = MMI_dummy_function;
  1004.     RedrawCategoryFunction = MMI_dummy_function;
  1005.     GetCategoryHistory = dummy_get_history;
  1006.     GetCategoryHistorySize = dummy_get_history_size;
  1007. }
  1008. /*****************************************************************************
  1009.  * FUNCTION
  1010.  *  DrawCate222CategoryControlArea
  1011.  * DESCRIPTION
  1012.  *  This function is used to draw the category controlled area of category222 screen
  1013.  * PARAMETERS
  1014.  *  coordinate      [IN/OUT]        Coordinates of category controlled area.
  1015.  * RETURNS
  1016.  *  void
  1017.  *****************************************************************************/
  1018. void DrawCate222CategoryControlArea(dm_coordinates *coordinate)
  1019. {
  1020.     /*----------------------------------------------------------------*/
  1021.     /* Local Variables                                                */
  1022.     /*----------------------------------------------------------------*/
  1023.     S32 str_height;
  1024.     S32 str_width;
  1025.     S32 spacing;
  1026.     /*----------------------------------------------------------------*/
  1027.     /* Code Body                                                      */
  1028.     /*----------------------------------------------------------------*/
  1029.     if (cat222_button_str_ptr != NULL)
  1030.     {
  1031.         gdi_layer_push_text_clip();
  1032.         gdi_layer_set_text_clip(0, UI_device_width - MMI_button_bar_height, UI_device_width - 1, UI_device_height - 1);
  1033.         /* draw button string */
  1034.         gui_set_font(&MMI_medium_font);
  1035.         gui_measure_string((UI_string_type) cat222_button_str_ptr, &str_width, &str_height);
  1036.         spacing = (MMI_button_bar_height - str_height) >> 1;
  1037.         if (r2lMMIFlag)
  1038.         {
  1039.             gui_move_text_cursor(spacing + str_width, UI_device_height - MMI_button_bar_height + spacing);
  1040.         }
  1041.         else
  1042.         {
  1043.             gui_move_text_cursor(spacing, UI_device_height - MMI_button_bar_height + spacing);
  1044.         }
  1045.         gui_set_text_color(gui_color(0, 0, 0));
  1046.         gui_print_text((UI_string_type) cat222_button_str_ptr);
  1047.         gdi_layer_pop_text_clip();
  1048.     }
  1049.     Cat222DrawTitle();
  1050. }
  1051. /*****************************************************************************
  1052.  * FUNCTION
  1053.  *  Cat222DrawTitle
  1054.  * DESCRIPTION
  1055.  *  draw cat 222 title
  1056.  * PARAMETERS
  1057.  *  void
  1058.  * RETURNS
  1059.  *  void
  1060.  *****************************************************************************/
  1061. static void Cat222DrawTitle(void)
  1062. {
  1063.     /*----------------------------------------------------------------*/
  1064.     /* Local Variables                                                */
  1065.     /*----------------------------------------------------------------*/
  1066.     S32 str_len;
  1067.     S32 index;
  1068.     S8 buf_filename_no_ext[(FMGR_MAX_FILE_LEN + 1) * ENCODING_LENGTH];
  1069.     S8 buf_filename_dest[(FMGR_MAX_FILE_LEN + 1) * ENCODING_LENGTH];
  1070.     /*----------------------------------------------------------------*/
  1071.     /* Code Body                                                      */
  1072.     /*----------------------------------------------------------------*/
  1073.     /* clear background */
  1074.     gdi_draw_solid_rect(
  1075.         0,
  1076.         (MMI_title_y + MMI_title_height),
  1077.         UI_device_width - 1,
  1078.         UI_device_height - MMI_button_bar_height - 1,
  1079.         GDI_COLOR_WHITE);
  1080.     if (cat222_title == 0)
  1081.     {
  1082.         /* display filename */
  1083.         str_len = pfnUnicodeStrlen(cat222_file_name_ptr);
  1084.         /* find file name - by finding "\" */
  1085.         for (index = str_len * 2 - 2; index >= 2; index -= 2)
  1086.         {
  1087.             if (pfnUnicodeStrncmp((PS8) & cat222_file_name_ptr[index], (PS8) L"\", 1) == 0)
  1088.             {
  1089.                 index += 2;
  1090.                 break;
  1091.             }
  1092.         }
  1093.         pfnUnicodeStrcpy((PS8) buf_filename_no_ext, (PS8) (&(cat222_file_name_ptr[index])));
  1094.         mmi_fmgr_hide_ext_name(buf_filename_no_ext);
  1095.         /* short name encoding */
  1096.         if (cat222_is_short_filename)
  1097.         {
  1098.             mmi_chset_mixed_text_to_ucs2_str(
  1099.                 (U8*) buf_filename_dest,
  1100.                 sizeof(buf_filename_dest),
  1101.                 (U8*) buf_filename_no_ext,
  1102.                 PhnsetGetDefEncodingType());
  1103.             ChangeTitle(cat222_title_icon, (PU8) (buf_filename_dest));
  1104.         }
  1105.         else
  1106.         {
  1107.             ChangeTitle(cat222_title_icon, (PU8) (buf_filename_no_ext));
  1108.         }
  1109.     }
  1110.     draw_title();
  1111. }
  1112. /*****************************************************************************
  1113.  * FUNCTION
  1114.  *  Cat222DecodeImage
  1115.  * DESCRIPTION
  1116.  *  Decode Image
  1117.  * PARAMETERS
  1118.  *  void
  1119.  * RETURNS
  1120.  *  void
  1121.  *****************************************************************************/
  1122. static void Cat222DecodeImage(void)
  1123. {
  1124.     /*----------------------------------------------------------------*/
  1125.     /* Local Variables                                                */
  1126.     /*----------------------------------------------------------------*/
  1127.     S32 image_width;
  1128.     S32 image_height;
  1129.     S32 display_wnd_width;
  1130.     S32 display_wnd_height;
  1131. #if defined(CAT222_IMAGE_FIT_CONTENT_SIZE)
  1132.     S32 rect_height = 0;
  1133.     S32 rect_width = 0;
  1134.     S32 rect_offset_x = 0;
  1135.     S32 rect_offset_y = 0;
  1136. #endif /* defined(CAT222_IMAGE_FIT_CONTENT_SIZE) */ 
  1137.     S32 offset_x = 0;
  1138.     S32 offset_y = 0;
  1139.     GDI_RESULT result = 0;
  1140.     S32 str_len;
  1141.     U16 image_type;
  1142.     UI_string_type err_str_ptr;
  1143.     FS_HANDLE fs_handle;
  1144.     U32 file_size;
  1145.     S32 line_height;
  1146. #ifdef CAT222_DECODE_TIME_TEST
  1147.     kal_uint32 start_tick;
  1148.     kal_uint32 end_tick;
  1149.     kal_uint32 decode_ms;
  1150.     S8 decode_timer_buf[30];
  1151.     S8 buf_filename_no_ext[(FMGR_MAX_FILE_LEN + 1) * ENCODING_LENGTH];  /* 101705 */
  1152.     S32 str_width;
  1153.     S32 str_height;
  1154. #endif /* CAT222_DECODE_TIME_TEST */ 
  1155. #if defined(CAT222_IMAGE_FIT_FULLSCREEN_SIZE) || defined(CAT222_IMAGE_FIT_CONTENT_SIZE)
  1156.     S32 resized_offset_x;
  1157.     S32 resized_offset_y;
  1158.     S32 resized_width;
  1159.     S32 resized_height;
  1160. #endif /* defined(CAT222_IMAGE_FIT_FULLSCREEN_SIZE) || defined(CAT222_IMAGE_FIT_CONTENT_SIZE) */ 
  1161. #ifdef __MMI_TVOUT__
  1162.     S32 tvout_resized_offset_x;
  1163.     S32 tvout_resized_offset_y;
  1164.     S32 tvout_resized_width;
  1165.     S32 tvout_resized_height;
  1166.     S32 tvout_max_width;
  1167.     S32 tvout_max_height;
  1168.     GDI_HANDLE tvout_layer;
  1169. #endif /* __MMI_TVOUT__ */ 
  1170.     /*----------------------------------------------------------------*/
  1171.     /* Code Body                                                      */
  1172.     /*----------------------------------------------------------------*/
  1173.     /* init */
  1174.     err_str_ptr = NULL;
  1175.     /* lock */
  1176.     gdi_layer_lock_frame_buffer();
  1177.     /* push clip */
  1178.     gdi_layer_push_clip();
  1179.     gdi_layer_push_text_clip();
  1180.     gdi_layer_set_clip(
  1181.         CAT222_IMAGE_SPACING,
  1182.         (MMI_title_y + MMI_title_height) + CAT222_IMAGE_SPACING,
  1183.         UI_device_width - CAT222_IMAGE_SPACING - 1,
  1184.         (MMI_title_y + MMI_title_height) + MMI_content_height - CAT222_IMAGE_SPACING - 1);
  1185.     /* get time tick before decoding */
  1186. #ifdef CAT222_DECODE_TIME_TEST
  1187.     kal_get_time(&start_tick);
  1188. #endif 
  1189.     /* Decode file */
  1190.     /* temp solution, waiting for decoder has resizer for gif and bmp */
  1191.     image_type = gdi_image_get_type_from_file(cat222_file_name_ptr);
  1192.     /* get file size */
  1193.     fs_handle = FS_Open((U16*) cat222_file_name_ptr, FS_READ_ONLY);
  1194.     if (fs_handle < 0)
  1195.     {
  1196.         /* open file failed */
  1197.         result = -1;
  1198.         err_str_ptr = (UI_string_type) GetString(FMGR_FS_FILE_NOT_FOUND_TEXT);
  1199.     }
  1200.     else
  1201.     {
  1202.         FS_GetFileSize(fs_handle, (kal_uint32*) & file_size);
  1203.         FS_Close(fs_handle);
  1204.     }
  1205. #ifndef CAT222_DECODE_TIME_TEST
  1206.     /* check file size limit and image siz limit */
  1207.     if (result >= 0)
  1208.     {
  1209.         switch (image_type)
  1210.         {
  1211.             case GDI_IMAGE_TYPE_SVG_FILE:
  1212.                 if (file_size > 200 * 1024)     /* file size check - 200k */
  1213.                 {
  1214.                     err_str_ptr = (UI_string_type) GetString(STR_ID_FMGR_FILE_TOO_LARGE_NO_DISPLAY);
  1215.                     result = -1;
  1216.                 }
  1217.                 break;
  1218.             case GDI_IMAGE_TYPE_JPG_FILE:
  1219.                 /* decoder will timeout if file too large, we dont need to protect here */
  1220.                 break;
  1221.             case GDI_IMAGE_TYPE_BMP_FILE:
  1222.             case GDI_IMAGE_TYPE_WBMP_FILE:
  1223.         #if defined(MT6228) || defined(MT6229)
  1224.                 if (file_size > 1536 * 1024)    /* 1.5M */
  1225.         #else 
  1226.                 if (file_size > 512 * 1024)     /* file size check - 512k */
  1227.         #endif 
  1228.                 {
  1229.                     err_str_ptr = (UI_string_type) GetString(STR_ID_FMGR_FILE_TOO_LARGE_NO_DISPLAY);
  1230.                     result = -1;
  1231.                 }
  1232.                 break;
  1233.             case GDI_IMAGE_TYPE_GIF_FILE:
  1234.                 break;
  1235.         }
  1236.     }
  1237. #endif /* CAT222_DECODE_TIME_TEST */ 
  1238.     /* get file dimension */
  1239.     if (result >= 0)
  1240.     {
  1241.         result = gdi_image_get_dimension_file((PS8) cat222_file_name_ptr, &image_width, &image_height);
  1242.         if (((image_width <= 0) || (image_height <= 0)) || result < 0)
  1243.         {
  1244.             result = -1;
  1245.             err_str_ptr = (UI_string_type) GetString(STR_ID_FMGR_INVALID_IMAGE_FORMAT);
  1246.         }
  1247.         else
  1248.         {
  1249.             cat222_img_width = image_width;
  1250.             cat222_img_height = image_height;
  1251.         }
  1252.     }
  1253.     
  1254. #if defined(CAT222_IMAGE_FIT_FULLSCREEN_SIZE)
  1255.     display_wnd_width = UI_device_width;
  1256.     display_wnd_height = UI_device_height;
  1257. #elif defined(CAT222_IMAGE_FIT_CONTENT_SIZE)
  1258.     display_wnd_width = UI_device_width - CAT222_IMAGE_SPACING * 2;
  1259.     display_wnd_height = MMI_content_height - CAT222_IMAGE_SPACING * 2;
  1260. #endif /* CAT222_TIME_FIT_XXX_SIZE */
  1261. #ifndef CAT222_DECODE_TIME_TEST
  1262.     /* check file size limit and image siz limit */
  1263.     if (result >= 0)
  1264.     {
  1265.         switch (image_type)
  1266.         {
  1267.             case GDI_IMAGE_TYPE_SVG_FILE:
  1268.             case GDI_IMAGE_TYPE_JPG_FILE:
  1269.             case GDI_IMAGE_TYPE_BMP_FILE:
  1270.             case GDI_IMAGE_TYPE_WBMP_FILE:
  1271.                 break;
  1272.             case GDI_IMAGE_TYPE_GIF_FILE:
  1273.                 /* image size check */
  1274.         #if defined(MT6228) || defined(MT6229)
  1275.                 if (image_width * image_height > 640 * 480 * 4)
  1276.         #else 
  1277.                 if (image_width * image_height > 640 * 480)
  1278.         #endif
  1279.                 {
  1280.                     err_str_ptr = (UI_string_type) GetString(STR_ID_FMGR_IMAGE_TOO_LARGE_NO_DISPLAY);
  1281.                     result = -1;
  1282.                 }
  1283.                 break;
  1284.         }
  1285.     }
  1286. #endif /* CAT222_DECODE_TIME_TEST */ 
  1287.     /* clear gdi working buffer */
  1288.     gdi_image_clear_work_buffer();
  1289.     if (result >= 0)
  1290.     {
  1291.         if (TRUE)
  1292.         {
  1293.             if ((display_wnd_width >= image_width) && (display_wnd_height >= image_height))
  1294.             {
  1295.             #if defined(CAT222_IMAGE_FIT_FULLSCREEN_SIZE)
  1296.                 /* align preview window at the center of screen */
  1297.                 offset_x = (display_wnd_width - image_width) >> 1;
  1298.                 offset_y = (display_wnd_height - image_height) >> 1;
  1299.                 /* set clip region as content region */
  1300.                 gdi_layer_set_clip(
  1301.                     0,
  1302.                     (MMI_title_y + MMI_title_height),
  1303.                     UI_device_width - 1,
  1304.                     (MMI_title_y + MMI_title_height) + MMI_content_height - 1);
  1305.                 if (image_type == GDI_IMAGE_TYPE_GIF_FILE || image_type == GDI_IMAGE_TYPE_M3D_FILE || image_type == GDI_IMAGE_TYPE_SVG_FILE)
  1306.                 {
  1307.                     result = gdi_image_draw_animation_file(
  1308.                                 offset_x,
  1309.                                 offset_y,
  1310.                                 (PS8) cat222_file_name_ptr,
  1311.                                 &cat222_anim_handle);
  1312.                 }
  1313.                 else
  1314.                 {
  1315.                     result = gdi_image_draw_file(offset_x, offset_y, (PS8) cat222_file_name_ptr);
  1316.                 }
  1317.             #elif defined(CAT222_IMAGE_FIT_CONTENT_SIZE)
  1318.                 /* align preview window at the center of screen */
  1319.                 offset_x = ((display_wnd_width - image_width + 1) >> 1) + CAT222_IMAGE_SPACING;
  1320.                 offset_y =
  1321.                     ((display_wnd_height - image_height + 1) >> 1) + (MMI_title_y + MMI_title_height) +
  1322.                     CAT222_IMAGE_SPACING;
  1323.                 /* set clip region as content region */
  1324.                 gdi_layer_set_clip(
  1325.                     0,
  1326.                     (MMI_title_y + MMI_title_height),
  1327.                     UI_device_width - 1,
  1328.                     (MMI_title_y + MMI_title_height) + MMI_content_height - 1);
  1329.                 if (image_type == GDI_IMAGE_TYPE_GIF_FILE || image_type == GDI_IMAGE_TYPE_M3D_FILE || image_type == GDI_IMAGE_TYPE_SVG_FILE)
  1330.                 {
  1331.                     result = gdi_image_draw_animation_file(
  1332.                                 offset_x,
  1333.                                 offset_y,
  1334.                                 (PS8) cat222_file_name_ptr,
  1335.                                 &cat222_anim_handle);
  1336.                 }
  1337.                 else
  1338.                 {
  1339.                     result = gdi_image_draw_file(offset_x, offset_y, (PS8) cat222_file_name_ptr);
  1340.                 }
  1341.                 rect_offset_x = offset_x;
  1342.                 rect_offset_y = offset_y;
  1343.                 resized_width = rect_width = image_width;
  1344.                 resized_height = rect_height = image_height;
  1345.             #endif /* CAT222_TIME_FIT_XXX_SIZE */
  1346.             }
  1347.             else
  1348.             {
  1349.             #if defined(CAT222_IMAGE_FIT_FULLSCREEN_SIZE)
  1350.                 gdi_image_util_fit_bbox(
  1351.                     display_wnd_width,
  1352.                     display_wnd_height,
  1353.                     image_width,
  1354.                     image_height,
  1355.                     &resized_offset_x,
  1356.                     &resized_offset_y,
  1357.                     &resized_width,
  1358.                     &resized_height);
  1359.                 gdi_layer_set_clip(
  1360.                     0,
  1361.                     (MMI_title_y + MMI_title_height),
  1362.                     UI_device_width - 1,
  1363.                     (MMI_title_y + MMI_title_height) + MMI_content_height - 1);
  1364.                 if (image_type == GDI_IMAGE_TYPE_GIF_FILE || image_type == GDI_IMAGE_TYPE_M3D_FILE || image_type == GDI_IMAGE_TYPE_SVG_FILE)
  1365.                 {
  1366.                     result = gdi_image_draw_animation_resized_file(
  1367.                                 resized_offset_x,
  1368.                                 resized_offset_y,
  1369.                                 resized_width,
  1370.                                 resized_height,
  1371.                                 (PS8) cat222_file_name_ptr);
  1372.                 }
  1373.                 else
  1374.                 {
  1375.                     result = gdi_image_draw_resized_file(
  1376.                                 resized_offset_x,
  1377.                                 resized_offset_y,
  1378.                                 resized_width,
  1379.                                 resized_height,
  1380.                                 (PS8) cat222_file_name_ptr);
  1381.                 }
  1382.             #elif defined(CAT222_IMAGE_FIT_CONTENT_SIZE)
  1383.                 gdi_image_util_fit_bbox(
  1384.                     display_wnd_width,
  1385.                     display_wnd_height,
  1386.                     image_width,
  1387.                     image_height,
  1388.                     &resized_offset_x,
  1389.                     &resized_offset_y,
  1390.                     &resized_width,
  1391.                     &resized_height);
  1392.                 offset_x = resized_offset_x + CAT222_IMAGE_SPACING;
  1393.                 offset_y = resized_offset_y + (MMI_title_y + MMI_title_height) + CAT222_IMAGE_SPACING;
  1394.                 gdi_layer_set_clip(
  1395.                     0,
  1396.                     (MMI_title_y + MMI_title_height),
  1397.                     UI_device_width - 1,
  1398.                     (MMI_title_y + MMI_title_height) + MMI_content_height - 1);
  1399.                 rect_offset_x = offset_x;
  1400.                 rect_offset_y = offset_y;
  1401.                 rect_width = resized_width;
  1402.                 rect_height = resized_height;
  1403.                 gdi_layer_set_clip(
  1404.                             rect_offset_x - 3,
  1405.                             rect_offset_y - 3,
  1406.                             rect_offset_x + rect_width + 2,
  1407.                             rect_offset_y + rect_height + 2);
  1408.                 if (image_type == GDI_IMAGE_TYPE_GIF_FILE || image_type == GDI_IMAGE_TYPE_M3D_FILE || image_type == GDI_IMAGE_TYPE_SVG_FILE)
  1409.                 {
  1410.                 
  1411.                     result = gdi_image_draw_animation_resized_file(
  1412.                                 offset_x,
  1413.                                 offset_y,
  1414.                                 resized_width,
  1415.                                 resized_height,
  1416.                                 (PS8) cat222_file_name_ptr,
  1417.                                 &cat222_anim_handle);
  1418.                 }
  1419.                 else
  1420.                 {
  1421.                     result = gdi_image_draw_resized_file(
  1422.                                 offset_x,
  1423.                                 offset_y,
  1424.                                 resized_width,
  1425.                                 resized_height,
  1426.                                 (PS8) cat222_file_name_ptr);
  1427.                 }
  1428.             #endif /* CAT222_TIME_FIT_XXX_SIZE */
  1429.             }
  1430.         }
  1431.         else    /* not jpeg file */
  1432.         {
  1433.         #if defined(CAT222_IMAGE_FIT_FULLSCREEN_SIZE)
  1434.             offset_x = (display_wnd_width - image_width) >> 1;
  1435.             offset_y = (display_wnd_height - image_height) >> 1;
  1436.             /* set clip region as content region */
  1437.             gdi_layer_set_clip(
  1438.                 0,
  1439.                 (MMI_title_y + MMI_title_height),
  1440.                 UI_device_width - 1,
  1441.                 (MMI_title_y + MMI_title_height) + MMI_content_height - 1);
  1442.             /* stop all animation and draw file */
  1443.             gdi_image_stop_animation_all();
  1444.             result = gdi_image_draw_animation_file(offset_x, offset_y, (PS8) cat222_file_name_ptr, &cat222_anim_handle);
  1445.         #elif defined(CAT222_IMAGE_FIT_CONTENT_SIZE)
  1446.             /* align image at the center of screen */
  1447.             offset_x = ((display_wnd_width - image_width + 1) >> 1) + CAT222_IMAGE_SPACING;
  1448.             offset_y =
  1449.                 ((display_wnd_height - image_height + 1) >> 1) + (MMI_title_y + MMI_title_height) +
  1450.                 CAT222_IMAGE_SPACING;
  1451.             if (offset_x < CAT222_IMAGE_SPACING)
  1452.             {
  1453.                 rect_offset_x = CAT222_IMAGE_SPACING;
  1454.                 rect_width = display_wnd_width;
  1455.             }
  1456.             else
  1457.             {
  1458.                 rect_offset_x = offset_x;
  1459.                 rect_width = image_width;
  1460.             }
  1461.             if (offset_y < ((MMI_title_y + MMI_title_height) + CAT222_IMAGE_SPACING))
  1462.             {
  1463.                 rect_offset_y = (MMI_title_y + MMI_title_height) + CAT222_IMAGE_SPACING;
  1464.                 rect_height = display_wnd_height;
  1465.             }
  1466.             else
  1467.             {
  1468.                 rect_offset_y = offset_y;
  1469.                 rect_height = image_height;
  1470.             }
  1471.             gdi_layer_set_clip(
  1472.                 CAT222_IMAGE_SPACING,
  1473.                 (MMI_title_y + MMI_title_height) + CAT222_IMAGE_SPACING,
  1474.                 UI_device_width - CAT222_IMAGE_SPACING - 1,
  1475.                 (MMI_title_y + MMI_title_height) + MMI_content_height - CAT222_IMAGE_SPACING - 1);
  1476.             /* stop all animation and draw file */
  1477.             gdi_image_stop_animation_all();
  1478.             result = gdi_image_draw_animation_file(offset_x, offset_y, (PS8) cat222_file_name_ptr, &cat222_anim_handle);
  1479.         #endif /* CAT222_TIME_FIT_XXX_SIZE */
  1480.         }   /* image type */
  1481.     }
  1482. #ifdef __MMI_TVOUT__
  1483.     /* prepare decode to TV-Out */
  1484.     if (cat222_is_fullscr_tvout == TRUE)
  1485.     {
  1486.         /* set TV out mode */
  1487.         if (mdi_tvout_is_enable())
  1488.         {
  1489.             /* calculate size */
  1490.             /* TODO: Mdi_tv shall provide an interface to get max size */
  1491.             tvout_max_width = 320;
  1492.             tvout_max_height = 240;
  1493.             if ((tvout_max_width >= image_width) && (tvout_max_height >= image_height))
  1494.             {
  1495.                 tvout_resized_width = image_width;
  1496.                 tvout_resized_height = image_height;
  1497.             }
  1498.             else
  1499.             {
  1500.                 gdi_image_util_fit_bbox(
  1501.                     tvout_max_width,
  1502.                     tvout_max_height,
  1503.                     image_width,
  1504.                     image_height,
  1505.                     &tvout_resized_offset_x,
  1506.                     &tvout_resized_offset_y,
  1507.                     &tvout_resized_width,
  1508.                     &tvout_resized_height);
  1509.             }
  1510.             /* if is fullscreen, we shall set to owner MMI Owner draw, to avoid GDI's update */
  1511.             mdi_tvout_set_owner(MDI_TV_OWNER_APP);
  1512.             /* set mode to owner draw */
  1513.             mdi_tvout_set_mode(
  1514.                 MDI_TV_MODE_OWNER_DRAW,
  1515.                 tvout_resized_width,    /* layer_width */
  1516.                 tvout_resized_height);  /* layer_height */
  1517.             tvout_layer = mdi_tvout_get_active_layer();
  1518.             gdi_layer_push_and_set_active(tvout_layer);
  1519.             gdi_layer_reset_clip();
  1520.             result = gdi_image_draw_resized_file(
  1521.                         0,
  1522.                         0,
  1523.                         tvout_resized_width,
  1524.                         tvout_resized_height,
  1525.                         (PS8) cat222_file_name_ptr);
  1526.             gdi_layer_pop_and_restore_active();
  1527.             /* blt to TV */
  1528.             mdi_tvout_blt();
  1529.         }
  1530.     }
  1531. #endif /* __MMI_TVOUT__ */ 
  1532.     /* calc decode time and print on screen */
  1533. #ifdef CAT222_DECODE_TIME_TEST
  1534.     if (result >= 0)
  1535.     {
  1536.         kal_get_time(&end_tick);
  1537.         decode_ms = kal_ticks_to_milli_secs(end_tick - start_tick);
  1538.         /* print to a tmp buffer */
  1539.         sprintf(buf_filename_no_ext, "%d ms", decode_ms);
  1540.         AnsiiToUnicodeString((kal_char*) (decode_timer_buf), (kal_char*) buf_filename_no_ext);
  1541.         gui_measure_string((UI_string_type) decode_timer_buf, &str_width, &str_height);
  1542.         offset_x = (UI_device_width - str_width) >> 1;
  1543.         offset_y = ((MMI_content_height - str_height) >> 1) + (MMI_title_y + MMI_title_height);
  1544.         gui_reset_text_clip();
  1545.         gui_set_text_color(gui_color(0, 0, 0));
  1546.         gui_set_text_border_color(gui_color(255, 255, 255));
  1547.         gui_move_text_cursor(offset_x, offset_y);
  1548.         gui_print_bordered_text((UI_string_type) decode_timer_buf);
  1549.     }
  1550. #endif /* CAT222_DECODE_TIME_TEST */ 
  1551.     if (result >= 0)
  1552.     {
  1553.     #if defined(CAT222_IMAGE_FIT_CONTENT_SIZE)
  1554.         /* if is fit content size mode, draw a rect to make the image like a photo */
  1555.         gdi_layer_set_clip(
  1556.             0,
  1557.             (MMI_title_y + MMI_title_height),
  1558.             UI_device_width - 1,
  1559.             (MMI_title_y + MMI_title_height) + MMI_content_height - 1);
  1560.         gdi_draw_rect(
  1561.             rect_offset_x - 3,
  1562.             rect_offset_y - 3,
  1563.             rect_offset_x + rect_width + 2,
  1564.             rect_offset_y + rect_height + 2,
  1565.             GDI_COLOR_BLACK);
  1566.     #endif /* defined(CAT222_IMAGE_FIT_CONTENT_SIZE) */ 
  1567.     }
  1568.     else
  1569.     {
  1570.         /* print error string */
  1571.         if (err_str_ptr == NULL)
  1572.         {
  1573.             if (result == GDI_JPEG_ERR_IMAGE_TOO_LARGE)
  1574.             {
  1575.                 err_str_ptr = (UI_string_type) GetString(FMGR_FS_OUT_OF_BUFFERS_TEXT);
  1576.             }
  1577.             else if (result == GDI_JPEG_ERR_DECODE_TIME_OUT)
  1578.             {
  1579.                 err_str_ptr = (UI_string_type) GetString(STR_ID_FMGR_SYSTEM_BUSY_TO_DECODE);
  1580.             }
  1581.             else
  1582.             {
  1583.                 err_str_ptr = (UI_string_type) GetString(STR_ID_FMGR_INVALID_IMAGE_FORMAT);
  1584.             }
  1585.         }
  1586.         gdi_draw_solid_rect(
  1587.             offset_x,
  1588.             offset_y,
  1589.             offset_x + resized_width - 1,
  1590.             offset_y + resized_height - 1,
  1591.             GDI_COLOR_WHITE);
  1592.         MMI_message_string = err_str_ptr;
  1593.         /* show error string in multi-line input box */
  1594.         str_len = pfnUnicodeStrlen((PS8) MMI_message_string);
  1595.         create_multiline_inputbox_set_buffer(MMI_message_string, str_len, str_len, 0);
  1596.         MMI_multiline_inputbox.flags |= UI_MULTI_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW
  1597.             | UI_MULTI_LINE_INPUT_BOX_CENTER_JUSTIFY
  1598.             | UI_MULTI_LINE_INPUT_BOX_DISABLE_BACKGROUND
  1599.             | UI_MULTI_LINE_INPUT_BOX_DISABLE_SCROLLBAR | UI_MULTI_LINE_INPUT_BOX_VIEW_MODE;
  1600.         MMI_multiline_inputbox.text_font = &MMI_medium_font;
  1601.         /* resize to content size and call show_xx_no_draw function to calc its line count */
  1602.         resize_multiline_inputbox(UI_device_width - 2, MMI_content_height);
  1603.         show_multiline_inputbox_no_draw();
  1604.         line_height = get_multiline_inputbox_line_height();
  1605.         /* resize and move to both vertical and horizontal center align */
  1606.         resize_multiline_inputbox(
  1607.             UI_device_width - 2,
  1608.             (MMI_multiline_inputbox.n_lines * line_height) + MULTILINE_INPUTBOX_HEIGHT_PAD + MMI_multiline_inputbox.text_y);
  1609.         move_multiline_inputbox(
  1610.             1,
  1611.             MMI_title_height + MMI_title_y + ((MMI_content_height - MMI_multiline_inputbox.height) >> 1));
  1612.         show_multiline_inputbox();
  1613.     }
  1614.     /* pop and blt */
  1615.     gdi_layer_pop_text_clip();
  1616.     gdi_layer_pop_clip();
  1617.     gdi_layer_unlock_frame_buffer();
  1618.     gdi_layer_blt_base_layer(0, 0, UI_device_width - 1, UI_device_height - 1);
  1619.     /* call decode result callback */
  1620.     if (cat222_decode_result_callback != NULL)
  1621.     {
  1622.         cat222_decode_result_callback(result);
  1623.     }
  1624. }
  1625. /*****************************************************************************
  1626.  * FUNCTION
  1627.  *  Cat222ToggleTVDisplay
  1628.  * DESCRIPTION
  1629.  *  Toggle TVout display
  1630.  * PARAMETERS
  1631.  *  void
  1632.  * RETURNS
  1633.  *  void
  1634.  *****************************************************************************/
  1635. #ifdef __MMI_TVOUT__
  1636. static void Cat222ToggleTVDisplay(void)
  1637. {
  1638.     /*----------------------------------------------------------------*/
  1639.     /* Local Variables                                                */
  1640.     /*----------------------------------------------------------------*/
  1641.     S32 tvout_max_width;
  1642.     S32 tvout_max_height;
  1643.     S32 tvout_resized_width;
  1644.     S32 tvout_resized_height;
  1645.     S32 tvout_resized_offset_x;
  1646.     S32 tvout_resized_offset_y;
  1647.     S32 result;
  1648.     GDI_HANDLE tvout_layer;
  1649.     /*----------------------------------------------------------------*/
  1650.     /* Code Body                                                      */
  1651.     /*----------------------------------------------------------------*/
  1652.     if (mdi_tvout_is_enable())
  1653.     {
  1654.         if (cat222_is_fullscr_tvout)
  1655.         {
  1656.             /* restore back to GDI */
  1657.             mdi_tvout_set_owner(MDI_TV_OWNER_GDI);
  1658.             /* restore back to start mode1 */
  1659.             mdi_tvout_set_mode(
  1660.                 MDI_TV_MODE_LCD_SCR,
  1661.                 0,  /* layer_width */
  1662.                 0); /* layer_height */
  1663.             gdi_layer_blt_previous(0, 0, UI_device_width - 1, UI_device_height - 1);
  1664.             cat222_is_fullscr_tvout = FALSE;
  1665.         }
  1666.         else
  1667.         {
  1668.             /* calculate size */
  1669.             /* TODO: Mdi_tv shall provide an interface to get max size */
  1670.             tvout_max_width = 320;
  1671.             tvout_max_height = 240;
  1672.             if ((tvout_max_width >= cat222_img_width) && (tvout_max_height >= cat222_img_height))
  1673.             {
  1674.                 tvout_resized_width = cat222_img_width;
  1675.                 tvout_resized_height = cat222_img_height;
  1676.             }
  1677.             else
  1678.             {
  1679.                 gdi_image_util_fit_bbox(
  1680.                     tvout_max_width,
  1681.                     tvout_max_height,
  1682.                     cat222_img_width,
  1683.                     cat222_img_height,
  1684.                     &tvout_resized_offset_x,
  1685.                     &tvout_resized_offset_y,
  1686.                     &tvout_resized_width,
  1687.                     &tvout_resized_height);
  1688.             }
  1689.             /* if is fullscreen, we shall set to owner MMI Owner draw, to avoid GDI's update */
  1690.             mdi_tvout_set_owner(MDI_TV_OWNER_APP);
  1691.             /* set mode to owner draw */
  1692.             mdi_tvout_set_mode(
  1693.                 MDI_TV_MODE_OWNER_DRAW,
  1694.                 tvout_resized_width,    /* layer_width */
  1695.                 tvout_resized_height);  /* layer_height */
  1696.             tvout_layer = mdi_tvout_get_active_layer();
  1697.             gdi_layer_push_and_set_active(tvout_layer);
  1698.             gdi_layer_reset_clip();
  1699.             result = gdi_image_draw_resized_file(
  1700.                         0,
  1701.                         0,
  1702.                         tvout_resized_width,
  1703.                         tvout_resized_height,
  1704.                         (PS8) cat222_file_name_ptr);
  1705.             gdi_layer_pop_and_restore_active();
  1706.             /* blt to TV */
  1707.             mdi_tvout_blt();
  1708.             cat222_is_fullscr_tvout = TRUE;
  1709.         }
  1710.     }
  1711. }
  1712. #endif /* __MMI_TVOUT__ */ 
  1713. /*****************************************************************************
  1714. * [Category223]
  1715. *
  1716. * This category is for play audio.
  1717. *
  1718. *  **********************
  1719. *  *       Caption      *
  1720. *  **********************
  1721. *  *                    *
  1722. *  *                    *
  1723. *  *       (Icon)       *
  1724. *  *                    *
  1725. *  *                    *
  1726. *  *      00:00:00      *
  1727. *  *                    *
  1728. *  *********    *********
  1729. *  *  LSK  *    *  RSK  *
  1730. *  **********************
  1731. *
  1732. *****************************************************************************/
  1733. /*****************************************************************************
  1734.  * FUNCTION
  1735.  *  ShowCategory223Screen
  1736.  * DESCRIPTION
  1737.  *  Show sategory 223 screen.
  1738.  * PARAMETERS
  1739.  *  title                   [IN]        Title string id
  1740.  *  title_icon              [IN]        Title image id
  1741.  *  left_softkey            [IN]        Lsk string id
  1742.  *  left_softkey_icon       [IN]        Lsk image id
  1743.  *  right_softkey           [IN]        Rsk string id
  1744.  *  right_softkey_icon      [IN]        Rsk image id
  1745.  *  message_icon            [IN]        Notification message icon
  1746.  *  flag                    [IN]        Time display type
  1747.  *  duration                [IN]        Audio duration
  1748.  *  history_buffer          [IN]        History buffer
  1749.  * RETURNS
  1750.  *  void
  1751.  *****************************************************************************/
  1752. void ShowCategory223Screen(
  1753.         U16 title,
  1754.         U16 title_icon,
  1755.         U16 left_softkey,
  1756.         U16 left_softkey_icon,
  1757.         U16 right_softkey,
  1758.         U16 right_softkey_icon,
  1759.         U16 message_icon,
  1760.         U16 flag,
  1761.         U32 duration,
  1762.         U8 *history_buffer)
  1763. {
  1764.     /*----------------------------------------------------------------*/
  1765.     /* Local Variables                                                */
  1766.     /*----------------------------------------------------------------*/
  1767.     dm_data_struct dm_data;
  1768.     S32 l, y, h, available_height, title_height = 0;
  1769.     S32 iwidth, iheight;
  1770.     PU8 image;
  1771.     UI_time t;
  1772.     /*----------------------------------------------------------------*/
  1773.     /* Code Body                                                      */
  1774.     /*----------------------------------------------------------------*/
  1775. #ifdef __MMI_UI_LIST_HIGHLIGHT_EFFECTS__
  1776.     gui_stop_list_highlight_effect();
  1777. #endif 
  1778.     ADD_SCREEN_STRINGS((4, title, left_softkey, right_softkey, message));
  1779.     ADD_SCREEN_IMAGES((4, title_icon, left_softkey_icon, right_softkey_icon, message_icon));
  1780.     UI_UNUSED_PARAMETER(history_buffer);
  1781.     gui_lock_double_buffer();
  1782. #ifdef __MMI_WALLPAPER_ON_BOTTOM__
  1783.     entry_full_screen();
  1784. #endif 
  1785.     MMI_menu_shortcut_number = -1;
  1786.     clear_category_screen_key_handlers();
  1787.     clear_left_softkey();
  1788.     clear_right_softkey();
  1789.     dm_data.s32flags = 0;
  1790.     if ((left_softkey == 0) && (left_softkey_icon == 0) && (right_softkey == 0) && (right_softkey_icon == 0))
  1791.     {
  1792.         dm_data.s32flags = DM_NO_SOFTKEY;
  1793.     }
  1794.     else
  1795.     {
  1796.         dm_data.s32flags = 0;
  1797.         wgui_category_screen_no_buttons = 0;
  1798.         change_left_softkey(left_softkey, left_softkey_icon);
  1799.         change_right_softkey(right_softkey, right_softkey_icon);
  1800.         register_left_softkey_handler();
  1801.         register_right_softkey_handler();
  1802.         register_default_hide_softkeys();
  1803.     }
  1804.     if ((title == 0) && (title_icon == 0))
  1805.     {
  1806.         status_icon = 1;
  1807.         ShowStatusIconsTitle();
  1808.     }
  1809.     else if (!((title == 0xffff) && (title_icon == 0xffff)))
  1810.     {
  1811.         status_icon = 2;
  1812.         MMI_title_string = (UI_string_type) get_string(title);
  1813.         MMI_title_icon = (PU8) get_image(title_icon);
  1814.     }
  1815.     else
  1816.     {
  1817.         status_icon = 0;
  1818.     }
  1819.     image = (PU8) get_image(message_icon);
  1820.     gui_measure_image(image, &iwidth, &iheight);
  1821.     available_height = MMI_content_height;
  1822.     if (dm_data.s32flags & DM_NO_SOFTKEY)
  1823.     {
  1824.         available_height += MMI_button_bar_height;
  1825.     }
  1826.     switch (status_icon)
  1827.     {
  1828.         case 0:
  1829.             title_height = 0;
  1830.             available_height += MMI_status_bar_height;
  1831.             break;
  1832.         case 1:
  1833.             title_height = MMI_title_height + MMI_status_bar_height;
  1834.             break;
  1835.         case 2:
  1836.             title_height = MMI_title_y + MMI_title_height;
  1837.             break;
  1838.     }
  1839.     l = 70; /* width of time display */
  1840.     h = 20; /* height of time display */
  1841.     wgui_image_clip_x1 = 0;
  1842.     wgui_image_clip_x2 = UI_device_width - 1;
  1843.     wgui_image_clip_y1 = title_height;
  1844.     if (dm_data.s32flags & DM_NO_SOFTKEY)
  1845.     {
  1846.         wgui_image_clip_y2 = UI_device_height - 1;
  1847.     }
  1848.     else
  1849.     {
  1850.         wgui_image_clip_y2 = UI_device_height - MMI_button_bar_height - 1;
  1851.     }
  1852.     Cat223InitDruration(&t, (U32) (duration * 0.004615 + 0.5));
  1853.     set_main_LCD_time_duration_hide_function(Cat223HideDurationDisplay);
  1854.     set_time_duration(&t, duration);
  1855.     cat223_display_duration = MMI_TRUE;
  1856.     if (image == NULL)
  1857.     {
  1858.         y = title_height + (available_height >> 1) - (h >> 1);
  1859.         set_time_display(flag, (UI_device_width - l) / 2, y, l, h);
  1860.     }
  1861.     else
  1862.     {
  1863.         y = title_height + (available_height >> 1) - ((h + iheight + 4) >> 1);
  1864.         if (category_screen_layout_flags & WGUI_ORDER_IMAGE_TEXT)
  1865.         {
  1866.             wgui_set_animation_image_y((UI_device_width >> 1), y + 2, image);
  1867.             y = y + iheight + 4;
  1868.             set_time_display(flag, (UI_device_width - l) / 2, y, l, h);
  1869.         }
  1870.         else
  1871.         {
  1872.             y = title_height + ((available_height - iheight - h) >> 1);
  1873.             set_time_display(flag, (UI_device_width - l) / 2, y, l, h);
  1874.             y = title_height + available_height - iheight;
  1875.             wgui_set_animation_image_y((UI_device_width >> 1), y, image);
  1876.         }
  1877.     }
  1878.     gui_unlock_double_buffer();
  1879.     ExitCategoryFunction = ExitCategory223Screen;
  1880.     dm_setup_category_functions(dm_redraw_category_screen, dm_get_category_history, dm_get_category_history_size);
  1881.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  1882.     dm_data.s32CatId = MMI_CATEGORY223_ID;
  1883.     dm_data.s32flags = DM_CLEAR_SCREEN_BACKGROUND;
  1884.     dm_setup_data(&dm_data);
  1885.     dm_register_category_controlled_callback(DrawCate223CategoryControlArea);
  1886.     dm_redraw_category_screen();
  1887. }
  1888. /*****************************************************************************
  1889.  * FUNCTION
  1890.  *  ExitCategory223Screen
  1891.  * DESCRIPTION
  1892.  *  Exit category 223
  1893.  * PARAMETERS
  1894.  *  void
  1895.  * RETURNS
  1896.  *  void
  1897.  *****************************************************************************/
  1898. static void ExitCategory223Screen(void)
  1899. {
  1900.     /*----------------------------------------------------------------*/
  1901.     /* Local Variables                                                */
  1902.     /*----------------------------------------------------------------*/
  1903.     /*----------------------------------------------------------------*/
  1904.     /* Code Body                                                      */
  1905.     /*----------------------------------------------------------------*/
  1906.     gui_hide_animations();
  1907.     wgui_category_screen_no_buttons = 0;
  1908.     category_screen_layout_flags = 0;
  1909.     close_main_LCD_time_display();
  1910. }
  1911. /*****************************************************************************
  1912.  * FUNCTION
  1913.  *  DrawCate223CategoryControlArea
  1914.  * DESCRIPTION
  1915.  *  This function is used to draw the category controlled area of category223 screen
  1916.  * PARAMETERS
  1917.  *  coordinate      [IN/OUT]        Coordinates of category controlled area.
  1918.  * RETURNS
  1919.  *  void
  1920.  *****************************************************************************/
  1921. static void DrawCate223CategoryControlArea(dm_coordinates *coordinate)
  1922. {
  1923.     /*----------------------------------------------------------------*/
  1924.     /* Local Variables                                                */
  1925.     /*----------------------------------------------------------------*/
  1926.     /*----------------------------------------------------------------*/
  1927.     /* Code Body                                                      */
  1928.     /*----------------------------------------------------------------*/
  1929.     gui_hide_animations();
  1930.     if (status_icon == 1)
  1931.     {
  1932.         show_status_icons();
  1933.     }
  1934.     else if (status_icon == 2)
  1935.     {
  1936.         show_title_status_icon();
  1937.         draw_title();
  1938.     }
  1939.     gui_set_clip(wgui_image_clip_x1, wgui_image_clip_y1, wgui_image_clip_x2, wgui_image_clip_y2);
  1940.     wgui_show_transparent_animation();
  1941.     if (cat223_display_duration == MMI_TRUE)
  1942.     {
  1943.         Cat223DrawDurationBar();
  1944.     }
  1945. }
  1946. /*****************************************************************************
  1947.  * FUNCTION
  1948.  *  Cat223DrawDurationBar
  1949.  * DESCRIPTION
  1950.  *  Draw duration bar
  1951.  * PARAMETERS
  1952.  *  void
  1953.  * RETURNS
  1954.  *  void
  1955.  *****************************************************************************/
  1956. static void Cat223DrawDurationBar(void)
  1957. {
  1958.     /*----------------------------------------------------------------*/
  1959.     /* Local Variables                                                */
  1960.     /*----------------------------------------------------------------*/
  1961.     /*----------------------------------------------------------------*/
  1962.     /* Code Body                                                      */
  1963.     /*----------------------------------------------------------------*/
  1964.     time_display_duration();
  1965. }
  1966. /*****************************************************************************
  1967.  * FUNCTION
  1968.  *  Cat223InitDruration
  1969.  * DESCRIPTION
  1970.  *  Init duration parameters
  1971.  * PARAMETERS
  1972.  *  t               [?]         
  1973.  *  duration        [IN]        
  1974.  * RETURNS
  1975.  *  void
  1976.  *****************************************************************************/
  1977. static void Cat223InitDruration(UI_time *t, U32 duration)
  1978. {
  1979.     /*----------------------------------------------------------------*/
  1980.     /* Local Variables                                                */
  1981.     /*----------------------------------------------------------------*/
  1982.     U32 buf1, buf2;
  1983.     /*----------------------------------------------------------------*/
  1984.     /* Code Body                                                      */
  1985.     /*----------------------------------------------------------------*/
  1986.     t->DayIndex = 0;
  1987.     buf1 = duration / 60;
  1988.     t->nSec = duration - buf1 * 60;
  1989.     buf2 = buf1 / 60;
  1990.     t->nMin = buf1 - buf2 * 60;
  1991.     t->nHour = (U8) buf2;
  1992. }
  1993. /*****************************************************************************
  1994.  * FUNCTION
  1995.  *  Cat223HideDurationDisplay
  1996.  * DESCRIPTION
  1997.  *  Hide duration display
  1998.  * PARAMETERS
  1999.  *  x1      [IN]        
  2000.  *  y1      [IN]        
  2001.  *  x2      [IN]        
  2002.  *  y2      [IN]        
  2003.  * RETURNS
  2004.  *  void
  2005.  *****************************************************************************/
  2006. static void Cat223HideDurationDisplay(S32 x1, S32 y1, S32 x2, S32 y2)
  2007. {
  2008.     /*----------------------------------------------------------------*/
  2009.     /* Local Variables                                                */
  2010.     /*----------------------------------------------------------------*/
  2011.     color c = *current_MMI_theme->datetime_bar_duration_background_color;
  2012.     /*----------------------------------------------------------------*/
  2013.     /* Code Body                                                      */
  2014.     /*----------------------------------------------------------------*/
  2015.     gui_push_clip();
  2016.     gui_set_clip(x1, y1, x2, y2);
  2017.     gui_fill_rectangle(x1, y1, x2, y2, c);
  2018.     gui_pop_clip();
  2019. }
  2020. /*****************************************************************************
  2021. * [Category224]
  2022. *
  2023. * This category is for play a video clip. Can be full screen or standard MMI style.
  2024. *
  2025. *  **********************
  2026. *  *                    *
  2027. *  *                    *
  2028. *  *                    *
  2029. *  *                    *
  2030. *  *                    *
  2031. *  * (Fullscreen Video) *
  2032. *  *                    *
  2033. *  *                    *
  2034. *  *                    *
  2035. *  *                    *
  2036. *  *                    *
  2037. *  **********************
  2038. *
  2039. *****************************************************************************/
  2040. #ifdef __MMI_VIDEO_PLAYER__
  2041. //#define  BLACK_BUFFER_SIZE ((GDI_LCD_WIDTH*GDI_LCD_HEIGHT*GDI_MAINLCD_BIT_PER_PIXEL)>>3)//061506 double buffer
  2042. static U8 *status_icon_buf = NULL;
  2043. static GDI_HANDLE status_icon_layer = GDI_ERROR_HANDLE;
  2044. U8 *gBlack_buf = NULL;
  2045. static gdi_handle *gBlack_layer = NULL;
  2046. /*****************************************************************************
  2047.  * FUNCTION
  2048.  *  ShowCategory224Screen
  2049.  * DESCRIPTION
  2050.  *  Show Category 224 Screen. Play video in full screen
  2051.  * PARAMETERS
  2052.  *  video_id                    [IN]        Video ID
  2053.  *  video_filename              [IN]        Video filename
  2054.  *  repeat_count                [IN]        Repeat count, 0 means infinite
  2055.  *  is_visual_update            [IN]        Update visual to LCM or not
  2056.  *  is_play_audio               [IN]        Play audio or not
  2057.  *  is_lcd_no_sleep             [IN]        Will let lcd no sleep. This shall always TRUE unless u will handle lcd sleeping event
  2058.  *  bg_color                    [IN]        Backgroud color
  2059.  *  play_finish_callback        [IN]        Play finish call back hdlr
  2060.  *  gui_buffer                  [IN]        Gui_buffer, use to detemin if it is newly enter
  2061.  * RETURNS
  2062.  *  void
  2063.  *****************************************************************************/
  2064. void ShowCategory224Screen(
  2065.         U16 video_id,
  2066.         PS8 video_filename,
  2067.         U16 repeat_count,
  2068.         BOOL is_visual_update,
  2069.         BOOL is_play_audio,
  2070.         BOOL is_lcd_no_sleep,
  2071.         GDI_COLOR bg_color,
  2072.         void (*play_finish_callback) (MDI_RESULT),
  2073.         void *gui_buffer)
  2074. {
  2075.     /*----------------------------------------------------------------*/
  2076.     /* Local Variables                                                */
  2077.     /*----------------------------------------------------------------*/
  2078.     /*----------------------------------------------------------------*/
  2079.     /* Code Body                                                      */
  2080.     /*----------------------------------------------------------------*/
  2081. #ifdef __MMI_VIDEO_PLAYER__
  2082.     ShowCategoryVdoplyScreen(
  2083.         TRUE,                   /* is_fullscreen *//* cat224 is fullscreen display */
  2084.         0,                      /* title_str */
  2085.         0,                      /* title_icon */
  2086.         0,                      /* lsk_str */
  2087.         0,                      /* lsk_icon */
  2088.         0,                      /* rsk_str */
  2089.         0,                      /* rsk_icon */
  2090.         video_id,               /* video_id */
  2091.         video_filename,         /* video_filename */
  2092.         repeat_count,           /* repeat_count */
  2093.         is_visual_update,       /* is_visual_update */
  2094.         is_play_audio,          /* is_play_audio */
  2095.         is_lcd_no_sleep,        /* is_lcd_no_sleep */
  2096.         bg_color,               /* bg_color */
  2097.         play_finish_callback,   /* play_finish_callback */
  2098.         gui_buffer);            /* gui_buffer */
  2099. #endif /* __MMI_VIDEO_PLAYER__ */ 
  2100. }
  2101. /*****************************************************************************
  2102.  * FUNCTION
  2103.  *  StopCategory224Video
  2104.  * DESCRIPTION
  2105.  *  Stop Category224 screen's video
  2106.  * PARAMETERS
  2107.  *  void
  2108.  * RETURNS
  2109.  *  void
  2110.  *****************************************************************************/
  2111. void StopCategory224Video(void)
  2112. {
  2113.     /*----------------------------------------------------------------*/
  2114.     /* Local Variables                                                */
  2115.     /*----------------------------------------------------------------*/
  2116.     /*----------------------------------------------------------------*/
  2117.     /* Code Body                                                      */
  2118.     /*----------------------------------------------------------------*/
  2119.     StopCategoryVdoplyVideo();
  2120. }
  2121. /*****************************************************************************
  2122.  * FUNCTION
  2123.  *  PauseCategory224Video
  2124.  * DESCRIPTION
  2125.  *  Pause Category224 screen's video
  2126.  * PARAMETERS
  2127.  *  void
  2128.  * RETURNS
  2129.  *  void
  2130.  *****************************************************************************/
  2131. void PauseCategory224Video(void)
  2132. {
  2133.     /*----------------------------------------------------------------*/
  2134.     /* Local Variables                                                */
  2135.     /*----------------------------------------------------------------*/
  2136.     /*----------------------------------------------------------------*/
  2137.     /* Code Body                                                      */
  2138.     /*----------------------------------------------------------------*/
  2139.     PauseCategoryVdoplyVideo();
  2140. }
  2141. /*****************************************************************************
  2142.  * FUNCTION
  2143.  *  ResumeCategory224Video
  2144.  * DESCRIPTION
  2145.  *  Resume Category224 screen's video
  2146.  * PARAMETERS
  2147.  *  void
  2148.  * RETURNS
  2149.  *  void
  2150.  *****************************************************************************/
  2151. void ResumeCategory224Video(void)
  2152. {
  2153.     /*----------------------------------------------------------------*/
  2154.     /* Local Variables                                                */
  2155.     /*----------------------------------------------------------------*/
  2156.     /*----------------------------------------------------------------*/
  2157.     /* Code Body                                                      */
  2158.     /*----------------------------------------------------------------*/
  2159.     ResumeCategoryVdoplyVideo();
  2160. }
  2161. /*****************************************************************************
  2162. * [ShowCategory225Screen]
  2163. *
  2164. * Play video screen with title and softkey
  2165. *
  2166. *  **********************
  2167. *  *        Title       *
  2168. *  **********************
  2169. *  *                    *
  2170. *  *                    *
  2171. *  *                    *
  2172. *  *       (Video)      *
  2173. *  *                    *
  2174. *  *                    *
  2175. *  *                    *
  2176. *  ********      ********
  2177. *  * LSK  *      *  RSK *
  2178. *  **********************
  2179. *
  2180. *****************************************************************************/
  2181. /*****************************************************************************
  2182.  * FUNCTION
  2183.  *  ShowCategory225Screen
  2184.  * DESCRIPTION
  2185.  *  Show Generic Play Video Category.
  2186.  * PARAMETERS
  2187.  *  title_str                   [IN]        Title string id
  2188.  *  title_icon                  [IN]        Title icon id
  2189.  *  lsk_str                     [IN]        Lsk str id
  2190.  *  lsk_icon                    [IN]        Lsk icon id
  2191.  *  rsk_str                     [IN]        Lsk str id
  2192.  *  rsk_icon                    [IN]        Lsk icon id
  2193.  *  video_id                    [IN]        Video ID
  2194.  *  video_filename              [IN]        Video filename
  2195.  *  repeat_count                [IN]        Repeat count, 0 means infinite
  2196.  *  is_visual_update            [IN]        Update visual to LCM or not
  2197.  *  is_play_audio               [IN]        Play audio or not
  2198.  *  is_lcd_no_sleep             [IN]        Will let lcd no sleep. This shall always TRUE unless u will handle lcd sleeping event
  2199.  *  bg_color                    [IN]        Backgroud color
  2200.  *  play_finish_callback        [IN]        Play finish call back hdlr
  2201.  *  gui_buffer                  [IN]        Gui_buffer, use to detemin if it is newly enter
  2202.  * RETURNS
  2203.  *  void
  2204.  *****************************************************************************/
  2205. extern void ShowCategory225Screen(
  2206.                 U16 title_str,
  2207.                 U16 title_icon,
  2208.                 U16 lsk_str,
  2209.                 U16 lsk_icon,
  2210.                 U16 rsk_str,
  2211.                 U16 rsk_icon,
  2212.                 U16 video_id,
  2213.                 PS8 video_filename,
  2214.                 U16 repeat_count,
  2215.                 BOOL is_visual_update,
  2216.                 BOOL is_play_audio,
  2217.                 BOOL is_lcd_no_sleep,
  2218.                 GDI_COLOR bg_color,
  2219.                 void (*play_finish_callback) (MDI_RESULT),
  2220.                 void *gui_buffer)
  2221. {
  2222.     /*----------------------------------------------------------------*/
  2223.     /* Local Variables                                                */
  2224.     /*----------------------------------------------------------------*/
  2225.     /*----------------------------------------------------------------*/
  2226.     /* Code Body                                                      */
  2227.     /*----------------------------------------------------------------*/
  2228. #ifdef __MMI_VIDEO_PLAYER__
  2229.     ShowCategoryVdoplyScreen(
  2230.         FALSE,                  /* is_fullscreen */
  2231.         title_str,              /* title_str */
  2232.         title_icon,             /* title_icon */
  2233.         lsk_str,                /* lsk_str */
  2234.         lsk_icon,               /* lsk_icon */
  2235.         rsk_str,                /* rsk_str */
  2236.         rsk_icon,               /* rsk_icon */
  2237.         video_id,               /* video_id */
  2238.         video_filename,         /* video_filename */
  2239.         repeat_count,           /* repeat_count */
  2240.         is_visual_update,       /* is_visual_update */
  2241.         is_play_audio,          /* is_play_audio */
  2242.         is_lcd_no_sleep,        /* is_lcd_no_sleep */
  2243.         bg_color,               /* bg_color */
  2244.         play_finish_callback,   /* play_finish_callback */
  2245.         gui_buffer);            /* gui_buffer */
  2246. #endif /* __MMI_VIDEO_PLAYER__ */ 
  2247. }
  2248. /*****************************************************************************
  2249.  * FUNCTION
  2250.  *  DrawCateVdoCategoryControlArea
  2251.  * DESCRIPTION
  2252.  *  draw vdo contro area
  2253.  * PARAMETERS
  2254.  *  coordinate      [IN/OUT]        Coord
  2255.  * RETURNS
  2256.  *  void
  2257.  *****************************************************************************/
  2258. void DrawCateVdoCategoryControlArea(dm_coordinates *coordinate)
  2259. {
  2260.     /*----------------------------------------------------------------*/
  2261.     /* Local Variables                                                */
  2262.     /*----------------------------------------------------------------*/
  2263.     S32 resized_width, resized_height;
  2264.     S32 resized_offset_x, resized_offset_y;
  2265.     S32 content_width, content_height;
  2266.     S32 content_offset_x, content_offset_y;
  2267.     MDI_RESULT video_ret;
  2268.     /*----------------------------------------------------------------*/
  2269.     /* Code Body                                                      */
  2270.     /*----------------------------------------------------------------*/
  2271.     if (!cat_vdoply_is_full_screen)
  2272.     {
  2273.         content_width = MMI_content_width;
  2274.         content_height = MMI_content_height;
  2275.         content_offset_x = MMI_content_x;
  2276.         content_offset_y = MMI_content_y;
  2277.     }
  2278.     else
  2279.     {
  2280.         content_width = UI_device_width;
  2281.         content_height = UI_device_height;
  2282.         content_offset_x = 0;
  2283.         content_offset_y = 0;
  2284.     }
  2285.     /* 061506 double buffer Start */
  2286.     /*******************************************************************************
  2287.     *  Special status icon handle with double buffer
  2288.     *******************************************************************************/
  2289.     if (wgui_is_touch_title_bar_buttons())
  2290.     {
  2291.     #if defined(__MMI_MAINLCD_176X220__) || defined(__MMI_MAINLCD_240X320__)
  2292.         U32 icon_flag;
  2293.     
  2294.         if (get_status_icon_bar_layer(0)==GDI_ERROR_HANDLE)
  2295.         {
  2296.             status_icon_buf = mmi_frm_scrmem_alloc(STATUS_ICON_BAR_DOUBLE_BUFFER_SIZE);
  2297.             MMI_ASSERT(status_icon_buf != NULL);
  2298.             gdi_layer_create_double_using_outside_memory(0, 0, UI_device_width, MMI_status_bar_height, &status_icon_layer, status_icon_buf, STATUS_ICON_BAR_DOUBLE_BUFFER_SIZE);
  2299.             MMI_ASSERT(status_icon_layer != GDI_ERROR_HANDLE);
  2300.             dm_add_blt_layer(status_icon_layer, DM_LAYER_TOP);
  2301.             gdi_layer_push_and_set_active(status_icon_layer);
  2302.             gdi_layer_set_source_key(TRUE, GDI_COLOR_TRANSPARENT);
  2303.             gdi_layer_clear(GDI_COLOR_TRANSPARENT);
  2304.             gdi_layer_pop_and_restore_active();
  2305.         }
  2306.         set_status_icon_bar_layer(0, status_icon_layer);
  2307.         icon_flag = get_status_icon_bar_type(0);
  2308.         icon_flag |= STATUS_ICON_BAR_ENABLE_DOUBLE_BUFFER;
  2309.         set_status_icon_bar_type(0, icon_flag);
  2310.         show_status_icons();
  2311.     #endif
  2312.     }
  2313.     /* 061506 double buffer End */
  2314.    /********************************************************************************
  2315.    *  Create Video Layer