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

MTK

开发平台:

C/C++

  1. /*******************************************************************************
  2. *  Modification Notice:
  3. *  --------------------------
  4. *  This software is modified by MediaTek Inc. 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.  * Filename:
  37.  * ---------
  38.  *   wgui_categories_sublcd.c
  39.  *
  40.  * Project:
  41.  * --------
  42.  *   Maui_Software
  43.  *
  44.  * Description:
  45.  * ------------
  46.  *  Sublcd display related categories.
  47.  *
  48.  * Author:
  49.  * -------
  50.  * -------
  51.  *
  52.  *------------------------------------------------------------------------------
  53.  * $Log$
  54.  *
  55.  * removed!
  56.  * removed!
  57.  * 
  58.  *
  59.  * removed!
  60.  * removed!
  61.  * 
  62.  *
  63.  * removed!
  64.  * removed!
  65.  * 
  66.  *
  67.  * removed!
  68.  * removed!
  69.  * 
  70.  *
  71.  * removed!
  72.  * removed!
  73.  * 
  74.  *
  75.  * removed!
  76.  * removed!
  77.  * 
  78.  *
  79.  * removed!
  80.  * removed!
  81.  * 
  82.  *
  83.  * removed!
  84.  * removed!
  85.  * 
  86.  *
  87.  * removed!
  88.  * removed!
  89.  * 
  90.  *
  91.  * removed!
  92.  * removed!
  93.  * 
  94.  *
  95.  * removed!
  96.  * removed!
  97.  * 
  98.  *
  99.  * removed!
  100.  * removed!
  101.  * 
  102.  *
  103.  * removed!
  104.  * removed!
  105.  * Rename ReadPhnset to PhnsetRead
  106.  *
  107.  * removed!
  108.  * removed!
  109.  * 
  110.  *
  111.  * removed!
  112.  * removed!
  113.  * 
  114.  *
  115.  * removed!
  116.  * removed!
  117.  * 
  118.  *
  119.  * removed!
  120.  * removed!
  121.  * 
  122.  *
  123.  * removed!
  124.  * removed!
  125.  * 
  126.  *
  127.  * removed!
  128.  * removed!
  129.  * 
  130.  *
  131.  * removed!
  132.  * removed!
  133.  * 
  134.  *
  135.  * removed!
  136.  * removed!
  137.  * 
  138.  *
  139.  * removed!
  140.  * removed!
  141.  * 
  142.  *
  143.  *******************************************************************************/
  144. /******************************************************************************
  145.  *
  146.  *  File:            %P%
  147.  *  -----
  148.  *
  149.  *  SCCS Version:    %I%
  150.  *  -------------
  151.  *
  152.  *  Copyright Statement:
  153.  *  --------------------
  154.  * Copyright Notice
  155.  * (c) 2002 - 2003, Pixtel Communications, Inc., 1489 43rd Ave. W.,
  156.  * Vancouver, B.C. V6M 4K8 Canada. All Rights Reserved.
  157.  *  (It is illegal to remove this copyright notice from this software or any
  158.  *  portion of it)
  159.  *
  160.  *  Project:        
  161.  *  --------
  162.  *
  163.  *  Software Unit:  plutommi
  164.  *  --------------
  165.  *
  166.  *  Description:
  167.  *  ------------
  168.  *  PixTel UI wrapper routines
  169.    High Level Category screen wrappers.
  170.  *  
  171.  *  Modification History:
  172.  *  ---------------------
  173.  *  Date          Vers           Auth  Details
  174.  *  ----          ----           ----  -------
  175.  *  2004/05/18 Initial version.    LeoHu Split from wgui_categories.c   
  176.  *
  177.  *****************************************************************************/
  178. #include "stdC.h"
  179. #include "L4Dr1.h"
  180. #include "PixtelDataTypes.h"
  181. #include "Unicodexdcl.h"
  182. #include "MMI_features.h"
  183. #include "EventsGprot.h"
  184. #include "CustDataProts.h"
  185. #include "CustMenuRes.h"
  186. #include "IdleAppDef.h"
  187. #include "GlobalDefs.h"
  188. #include "FrameworkStruct.h"
  189. #include "EventsDef.h"
  190. #include "TimerEvents.h"
  191. #include "gui_themes.h"
  192. #include "wgui.h"
  193. #include "wgui_categories_sublcd.h"
  194. #include "wgui_categories_defs.h"
  195. #include "wgui_categories_util.h"
  196. #include "wgui_softkeys.h"
  197. #include "wgui_menu_shortcuts.h"
  198. #include "wgui_fixed_menus.h"
  199. #include "wgui_fixed_menuitems.h"
  200. #include "wgui_inputs.h"
  201. #include "wgui_status_icons.h"
  202. #include "wgui_datetime.h"
  203. #include "WallpaperDefs.h"
  204. #include "ScreenSaverDefs.h"
  205. #include "DebugInitDef.h"
  206. #include "MainMenuDef.h"
  207. #include "gdi_include.h"        /* include for graphic lib */
  208. #include "lcd_sw_rnd.h"
  209. #include "IdleAppDef.h"
  210. #include "SimDetectionGexdcl.h"
  211. #include "wgui_draw_manager.h"
  212. #ifdef __MMI_SUB_WALLPAPER__
  213. #include "WPSSProtos.h" /* diamond, 2005/06/21 bad file callback */
  214. #endif 
  215. /*
  216.  * Local Variable
  217.  */
  218. static multi_line_input_box SUBLCD_input_box;
  219. /* Store the message of current multibox dispaly on sub lcd */
  220. static UI_string_type SUBLCD_MMI_message_string;
  221. static S32 category311_text_offset_x = 0;
  222. static S32 category311_text_width = 0;
  223. static S32 category311_text_height = 0;
  224. static MMI_BOOL g_mmi_gui_in_cat310 = MMI_FALSE;
  225. #ifdef __MMI_SUB_WALLPAPER__
  226. static GDI_HANDLE *sublcd_wallpaper_layer = NULL;
  227. static GDI_HANDLE sublcd_wallpaper_animation_handle = GDI_ERROR_HANDLE;
  228. static MMI_ID_TYPE idle_screen_wallpaper_sub_ID = 0;
  229. static U8 sub_wallpaper_buf[GDI_SUBLCD_WIDTH * GDI_SUBLCD_HEIGHT * GDI_SUBLCD_BIT_PER_PIXEL];
  230. /* store the x position of wallpaer of idle screen */
  231. static S32 cat312_image_x;
  232. /* store the y position of wallpaer of idle screen */
  233. static S32 cat312_image_y;
  234. /* store the image width  of wallpaer of idle screen */
  235. static S32 cat312_image_width;
  236. /* store the image height  of wallpaer of idle screen */
  237. static S32 cat312_image_height;
  238. /* store the total number frames  of animation wallpaper */
  239. #endif /* __MMI_SUB_WALLPAPER__ */ 
  240. /*
  241.  * Local Function
  242.  */
  243. /*
  244.  * Global Variable
  245.  */
  246. extern BOOL r2lMMIFlag;
  247. #ifdef __MMI_SUB_WALLPAPER__
  248. extern S8 *idle_screen_wallpaper_sub_name;
  249. #endif 
  250. S32 Sub_lcd_title_height = 13;
  251. #ifdef __MMI_SUB_WALLPAPER__
  252. GDI_HANDLE sublcd_base_layer = GDI_ERROR_HANDLE;
  253. MMI_BOOL is_sub_idle_screen = MMI_FALSE;
  254. #endif /* __MMI_SUB_WALLPAPER__ */ 
  255. /*
  256.  * Used in wgui_show_animation serial functions
  257.  * After revise these codes, the following variables can be saved
  258.  */
  259. PU8 SUBLCD_MMI_animated_icon = NULL;
  260. S32 SUBLCD_MMI_animated_icon_x = 0;
  261. S32 SUBLCD_MMI_animated_icon_y = 0;
  262. UI_animated_image_handle SUBLCD_MMI_animated_icon_handle = NULL;
  263. /*
  264.  * Global Function
  265.  */
  266. extern void arrange_status_icons_sublcd(void);
  267. extern void UI_set_sub_LCD_graphics_context(void);
  268. extern BOOL IsClamClose(void);
  269. extern void wgui_set_animation_y(S32 x, S32 y, MMI_ID_TYPE img);
  270. extern void get_time_difference(MYTIME *time_303, FLOAT city_diff);
  271. extern void show_analog_clock(void);
  272. extern void analog_clock_initialize(void);
  273. extern void ShowSubLCDChargingScr(void);
  274. extern void ShowSubLCDChargingCompleteScr(void);
  275. #ifdef __MMI_ANALOG_CLOCK__
  276. extern void show_analog_clock(void);
  277. extern void analog_clock_initialize(void);
  278. #endif /* __MMI_ANALOG_CLOCK__ */ 
  279. /*****************************************************************************
  280. * FUNCTION
  281. *  SUBLCD_ExitCategoryFunction
  282. *
  283. * DESCRIPTION
  284. *   function pointer store the address of exit function of current sub lcd category scrren
  285. *
  286. * PARAMETERS
  287. *  void
  288. *
  289. * RETURNS
  290. *  void
  291. *
  292. * GLOBALS AFFECTED
  293. *
  294. *****************************************************************************/
  295. void (*SUBLCD_ExitCategoryFunction) (void) = UI_dummy_function;
  296. /*****************************************************************************
  297. * FUNCTION
  298. *  SUBLCD_RedrawCategoryFunction
  299. *
  300. * DESCRIPTION
  301. *   function pointer store the address of redraw function of current sub lcd category scrren
  302. *
  303. * PARAMETERS
  304. *  void
  305. *
  306. * RETURNS
  307. *  void
  308. *
  309. * GLOBALS AFFECTED
  310. *
  311. *****************************************************************************/
  312. void (*SUBLCD_RedrawCategoryFunction) (void) = UI_dummy_function;
  313. /*****************************************************************************
  314. * FUNCTION
  315. *  SUBLCD_GetCategoryHistory
  316. *
  317. * DESCRIPTION
  318. *   function pointer store the address of getcategoryhistory function of current sub lcd category scrren
  319. *
  320. * PARAMETERS
  321. *  buffer      IN/OUT      history buffer
  322. *
  323. * RETURNS
  324. *  U8*
  325. *
  326. * GLOBALS AFFECTED
  327. *
  328. *****************************************************************************/
  329. U8 *(*SUBLCD_GetCategoryHistory) (U8 *buffer) = dummy_get_history;
  330. /*****************************************************************************
  331.  * FUNCTION
  332.  *  SUBLCD_screens_show_status_icons
  333.  * DESCRIPTION
  334.  *  function pointer store the address of getcategoryhistory function of current sub lcd category scrren
  335.  * PARAMETERS
  336.  *  void
  337.  * RETURNS
  338.  *  S32(?)
  339.  *****************************************************************************/
  340. S32(*SUBLCD_GetCategoryHistorySize) (void) = dummy_get_history_size;
  341. /*
  342.  * void initialize_sublcd_category_screen(void)
  343.  * {
  344.  * SUBLCD_ExitCategoryFunction=MMI_dummy_function;
  345.  * SUBLCD_RedrawCategoryFunction=MMI_dummy_function;
  346.  * SUBLCD_GetCategoryHistory=dummy_get_history;
  347.  * SUBLCD_GetCategoryHistorySize=dummy_get_history_size;
  348.  * }
  349.  */
  350. #if (0)
  351. /* under construction !*/
  352. /* under construction !*/
  353. /* under construction !*/
  354. /* under construction !*/
  355. /* under construction !*/
  356. /* under construction !*/
  357. /* under construction !*/
  358. /* under construction !*/
  359. /* under construction !*/
  360. /* under construction !*/
  361. /* under construction !*/
  362. /* under construction !*/
  363. #ifdef __MMI_SUBLCD_SHOW_ANALOG_CLOCK__
  364. /* under construction !*/
  365. #endif
  366. /* under construction !*/
  367. /* under construction !*/
  368. /* under construction !*/
  369. /* under construction !*/
  370. /* under construction !*/
  371. /* under construction !*/
  372. #endif /* (0) */ 
  373. void SUBLCD_screens_show_status_icons(void)
  374. {
  375. #ifdef __MMI_SUBLCD__
  376.     /*----------------------------------------------------------------*/
  377.     /* Local Variables                                                */
  378.     /*----------------------------------------------------------------*/
  379.     /*----------------------------------------------------------------*/
  380.     /* Code Body                                                      */
  381.     /*----------------------------------------------------------------*/
  382. #ifdef __MMI_SUBLCD_SHOW_ANALOG_CLOCK__
  383.     return;
  384. #endif 
  385.     GDI_LOCK;
  386.     gdi_layer_push_clip();
  387.     set_status_icon_display(SUBLCD_ONLY);
  388.     show_status_icons();
  389.     reset_status_icon_display();
  390.     gdi_layer_reset_clip();
  391.     gdi_layer_pop_clip();
  392. #ifndef __MMI_STATUS_BAR_NO_UNDERLINE__
  393.     gdi_draw_line(0, Sub_lcd_title_height - 1, UI_device_width - 1, Sub_lcd_title_height - 1, GDI_COLOR_BLACK);
  394. #endif 
  395.     GDI_UNLOCK;
  396. #endif /* __MMI_SUBLCD__ */ 
  397. }
  398. /*****************************************************************************
  399.  * FUNCTION
  400.  *  SUBLCD_screens_hide_status_icons
  401.  * DESCRIPTION
  402.  *  
  403.  * PARAMETERS
  404.  *  void
  405.  * RETURNS
  406.  *  void
  407.  *****************************************************************************/
  408. void SUBLCD_screens_hide_status_icons(void)
  409. {
  410. #ifdef __MMI_SUBLCD__
  411.     /*----------------------------------------------------------------*/
  412.     /* Local Variables                                                */
  413.     /*----------------------------------------------------------------*/
  414.     /*----------------------------------------------------------------*/
  415.     /* Code Body                                                      */
  416.     /*----------------------------------------------------------------*/
  417. #ifdef __MMI_SUBLCD_SHOW_ANALOG_CLOCK__
  418.     return;
  419. #endif 
  420.     GDI_LOCK;
  421.     UI_set_sub_LCD_graphics_context();
  422.     show_sublcd_status_background(0, 0, (UI_device_width - 1), Sub_lcd_title_height - 1, MMI_TRUE);
  423.     UI_set_main_LCD_graphics_context();
  424.     GDI_UNLOCK;
  425. #endif /* __MMI_SUBLCD__ */ 
  426. }
  427. /*****************************************************************************
  428.  * FUNCTION
  429.  *  ShowSubLCDStatusIconsTitle
  430.  * DESCRIPTION
  431.  *  show staus bar on sub lcd screen
  432.  * PARAMETERS
  433.  *  void
  434.  *  S16(?)      [IN]        Icon_ID
  435.  * RETURNS
  436.  *  void
  437.  *****************************************************************************/
  438. void ShowSubLCDStatusIconsTitle(void)
  439. {
  440.     /*----------------------------------------------------------------*/
  441.     /* Local Variables                                                */
  442.     /*----------------------------------------------------------------*/
  443.     /*----------------------------------------------------------------*/
  444.     /* Code Body                                                      */
  445.     /*----------------------------------------------------------------*/
  446. #ifdef __MMI_SUBLCD_SHOW_ANALOG_CLOCK__
  447.     return;
  448. #endif 
  449.     GDI_LOCK;
  450.     register_hide_status_icon_bar(2, SUBLCD_screens_hide_status_icons);
  451.     show_status_icon_bar(2);
  452.     GDI_UNLOCK;
  453. }
  454. /*****************************************************************************
  455.  * FUNCTION
  456.  *  SUBLCD_screens_hide_date_time
  457.  * DESCRIPTION
  458.  *  
  459.  * PARAMETERS
  460.  *  x1      [IN]        
  461.  *  y1      [IN]        
  462.  *  x2      [IN]        
  463.  *  y2      [IN]        
  464.  * RETURNS
  465.  *  void
  466.  *****************************************************************************/
  467. void SUBLCD_screens_hide_date_time(S32 x1, S32 y1, S32 x2, S32 y2)
  468. {
  469. #ifdef __MMI_SUBLCD__
  470.     /*----------------------------------------------------------------*/
  471.     /* Local Variables                                                */
  472.     /*----------------------------------------------------------------*/
  473.     /*----------------------------------------------------------------*/
  474.     /* Code Body                                                      */
  475.     /*----------------------------------------------------------------*/
  476. #ifdef __MMI_SUBLCD_SHOW_ANALOG_CLOCK__
  477.     if (!IsClamClose())
  478.     {
  479.         return;
  480.     }
  481. #endif /* __MMI_SUBLCD_SHOW_ANALOG_CLOCK__ */ 
  482.     GDI_LOCK;
  483.     gdi_layer_reset_clip();
  484. #ifdef __MMI_SUB_WALLPAPER__
  485.     gdi_draw_solid_rect(x1, y1, x2, y2, GDI_COLOR_TRANSPARENT);
  486. #else 
  487.     show_sublcd_status_background(x1, y1, x2, y2, MMI_FALSE);
  488. #endif 
  489.     gdi_layer_blt_previous(x1, y1, x2, y2);
  490.     GDI_UNLOCK;
  491. #endif /* __MMI_SUBLCD__ */ 
  492. }
  493. /*****************************************************************************
  494.  * FUNCTION
  495.  *  dm_category301_callback
  496.  * DESCRIPTION
  497.  *  Draws the category301 screen category control area
  498.  * PARAMETERS
  499.  *  coordinates     [?]     
  500.  * RETURNS
  501.  *  void
  502.  *****************************************************************************/
  503. void dm_category301_callback(dm_coordinates *coordinates)
  504. {
  505. #ifdef __MMI_SUBLCD__
  506.     /*----------------------------------------------------------------*/
  507.     /* Local Variables                                                */
  508.     /*----------------------------------------------------------------*/
  509.     /*----------------------------------------------------------------*/
  510.     /* Code Body                                                      */
  511.     /*----------------------------------------------------------------*/
  512.     if (SUBLCD_MMI_message_string)
  513.     {
  514.         S32 sw, sh, y, fh;
  515.         SUBLCD_input_box.flags |= UI_MULTI_LINE_INPUT_BOX_DISABLE_DRAW;
  516.         gui_show_multi_line_input_box(&SUBLCD_input_box);
  517.         SUBLCD_input_box.flags &= ~UI_MULTI_LINE_INPUT_BOX_DISABLE_DRAW;
  518.         gui_set_font(SUBLCD_input_box.text_font);
  519.         fh = get_multiline_inputbox_line_height_with_obj(&SUBLCD_input_box);
  520.         y = (SUBLCD_input_box.n_lines * fh) + 4 /* MULTILINE_INPUTBOX_HEIGHT_PAD */  + SUBLCD_input_box.text_y;
  521.         gui_resize_multi_line_input_box(&SUBLCD_input_box, SUBLCD_input_box.width, y);
  522.         gui_measure_string(SUBLCD_MMI_message_string, &sw, &sh);
  523.         if (SUB_LCD_device_width - sw < 0)
  524.         {
  525.             gui_move_multi_line_input_box(&SUBLCD_input_box, 0, (SUB_LCD_device_height - SUBLCD_input_box.height) >> 1);
  526.         }
  527.         else
  528.         {
  529.             gui_move_multi_line_input_box(
  530.                 &SUBLCD_input_box,
  531.                 (SUB_LCD_device_width - sw) >> 1,
  532.                 (SUB_LCD_device_height - SUBLCD_input_box.height) >> 1);
  533.         }
  534.         coordinates->s16Y = y;
  535.         coordinates->s16Width = SUBLCD_input_box.width;
  536.         coordinates->s16X = SUBLCD_input_box.x;
  537.         coordinates->s16Height = 18;
  538.         gui_show_multi_line_input_box(&SUBLCD_input_box);
  539.     }
  540.     else
  541.     {
  542.         coordinates->s16Y = (UI_device_height >> 1);
  543.         coordinates->s16Width = 0;
  544.         coordinates->s16X = 0;
  545.         coordinates->s16Height = 0;
  546.     }
  547. #endif /* __MMI_SUBLCD__ */ 
  548. }
  549. /*****************************************************************************
  550.  * FUNCTION
  551.  *  ShowCategory301Screen
  552.  * DESCRIPTION
  553.  *  Displays the category301 screen
  554.  * PARAMETERS
  555.  *  message             [IN]        Message string
  556.  *  message_icon        [IN]        
  557.  *  history_buffer      [IN]        History buffer
  558.  *  MMI_ID_TYPE(?)      [IN]        Icon        Message icon
  559.  * RETURNS
  560.  *  void
  561.  *****************************************************************************/
  562. void ShowCategory301Screen(U8 *message, U16 message_icon, U8 *history_buffer)
  563. {
  564. #ifdef __MMI_SUBLCD__
  565.     /*----------------------------------------------------------------*/
  566.     /* Local Variables                                                */
  567.     /*----------------------------------------------------------------*/
  568.     S32 l;
  569.     dm_data_struct dm_data;
  570.     /*----------------------------------------------------------------*/
  571.     /* Code Body                                                      */
  572.     /*----------------------------------------------------------------*/
  573. #ifdef __MMI_SUBLCD_SHOW_ANALOG_CLOCK__
  574.     if (!IsClamClose())
  575.     {
  576.         return;
  577.     }
  578. #endif /* __MMI_SUBLCD_SHOW_ANALOG_CLOCK__ */ 
  579.     GDI_LOCK;
  580.     SUBLCD_ExitCategoryFunction();
  581.     UI_set_sub_LCD_graphics_context();
  582.     gdi_layer_lock_frame_buffer();
  583.     SUBLCD_MMI_message_string = (UI_string_type) message;
  584.     if (message == 0)
  585.     {
  586.         SUBLCD_MMI_message_string = NULL;
  587.     }
  588.     else    /* message==0 */
  589.     {
  590.         l = gui_strlen(SUBLCD_MMI_message_string);
  591.         gui_create_multi_line_input_box_set_buffer(
  592.             &SUBLCD_input_box,
  593.             0,
  594.             20,
  595.             UI_device_width,
  596.             UI_device_height,
  597.             SUBLCD_MMI_message_string,
  598.             (l + 1) * ENCODING_LENGTH,
  599.             (l + 1) * ENCODING_LENGTH,
  600.             0);
  601.         SUBLCD_input_box.text_gap = 0;
  602.         SUBLCD_input_box.text_font = &MMI_small_font;
  603.     #ifdef __MMI_KLG__
  604.         SUBLCD_input_box.normal_text_color = UI_COLOR_WHITE;
  605.     #endif 
  606.         SUBLCD_input_box.flags |=
  607.             (UI_MULTI_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW | UI_MULTI_LINE_INPUT_BOX_DISABLE_BACKGROUND |
  608.              UI_MULTI_LINE_INPUT_BOX_DISABLE_SCROLLBAR | UI_MULTI_LINE_INPUT_BOX_VIEW_MODE);
  609.     }   /* message==0 */
  610.     ShowSubLCDStatusIconsTitle();
  611.     gdi_layer_unlock_frame_buffer();
  612.     SUBLCD_ExitCategoryFunction = ExitCategory301Screen;
  613.     SUBLCD_GetCategoryHistory = dummy_get_history;
  614.     SUBLCD_GetCategoryHistorySize = dummy_get_history_size;
  615.     dm_register_sub_category_controlled_callback(dm_category301_callback);
  616.     if (message_icon != 0)
  617.     {
  618.         dm_add_image(get_image(message_icon), NULL, NULL);
  619.     }
  620.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  621.     dm_data.s32CatId = MMI_CATEGORY301_ID;
  622.     dm_data.s32flags = DM_SUB_LCD_CONTEXT;
  623.     dm_sublcd_setup_data(&dm_data);
  624.     SUBLCD_RedrawCategoryFunction = dm_sublcd_redraw_category_screen;
  625.     dm_sublcd_redraw_category_screen();
  626.     UI_set_main_LCD_graphics_context();
  627.     GDI_UNLOCK;
  628. #endif /* __MMI_SUBLCD__ */ 
  629. }
  630. /*****************************************************************************
  631.  * FUNCTION
  632.  *  ExitCategory301Screen
  633.  * DESCRIPTION
  634.  *  Exits the category301 screen
  635.  * PARAMETERS
  636.  *  void
  637.  * RETURNS
  638.  *  void
  639.  *****************************************************************************/
  640. void ExitCategory301Screen(void)
  641. {
  642. #ifdef __MMI_SUBLCD__
  643.     /*----------------------------------------------------------------*/
  644.     /* Local Variables                                                */
  645.     /*----------------------------------------------------------------*/
  646.     /*----------------------------------------------------------------*/
  647.     /* Code Body                                                      */
  648.     /*----------------------------------------------------------------*/
  649.     UI_set_sub_LCD_graphics_context();
  650.     close_status_icons();
  651.     UI_set_main_LCD_graphics_context();
  652. #endif /* __MMI_SUBLCD__ */ 
  653. }
  654. /*****************************************************************************
  655.  * FUNCTION
  656.  *  RedrawCategory302Screen
  657.  * DESCRIPTION
  658.  *  Redraws the category302 screen
  659.  * PARAMETERS
  660.  *  void
  661.  * RETURNS
  662.  *  void
  663.  *****************************************************************************/
  664. void RedrawCategory302Screen(void)
  665. {
  666. #ifdef __MMI_SUBLCD__
  667.     /*----------------------------------------------------------------*/
  668.     /* Local Variables                                                */
  669.     /*----------------------------------------------------------------*/
  670.     /*----------------------------------------------------------------*/
  671.     /* Code Body                                                      */
  672.     /*----------------------------------------------------------------*/
  673.     UI_set_sub_LCD_graphics_context();
  674.     gdi_layer_lock_frame_buffer();
  675.     show_sublcd_status_background(0, 0, (UI_device_width - 1), (UI_device_height - 1), MMI_FALSE);
  676.     gdi_layer_unlock_frame_buffer();
  677.     gdi_layer_blt_previous(0, 0, UI_device_width - 1, UI_device_height - 1);
  678.     UI_set_main_LCD_graphics_context();
  679. #endif /* __MMI_SUBLCD__ */ 
  680. }
  681. /*****************************************************************************
  682.  * FUNCTION
  683.  *  ShowCategory302Screen
  684.  * DESCRIPTION
  685.  *  Displays the category302 screen  (Clears SUB LCD)
  686.  * PARAMETERS
  687.  *  history_buffer      [IN]        History buffer
  688.  * RETURNS
  689.  *  void
  690.  *****************************************************************************/
  691. void ShowCategory302Screen(U8 *history_buffer)
  692. {
  693. #ifdef __MMI_SUBLCD__
  694.     /*----------------------------------------------------------------*/
  695.     /* Local Variables                                                */
  696.     /*----------------------------------------------------------------*/
  697.     /*----------------------------------------------------------------*/
  698.     /* Code Body                                                      */
  699.     /*----------------------------------------------------------------*/
  700. #ifdef __MMI_SUBLCD_SHOW_ANALOG_CLOCK__
  701.     if (!IsClamClose())
  702.     {
  703.         return;
  704.     }
  705. #endif /* __MMI_SUBLCD_SHOW_ANALOG_CLOCK__ */ 
  706.     GDI_LOCK;
  707.     SUBLCD_ExitCategoryFunction();
  708.     SUBLCD_ExitCategoryFunction = ExitCategory302Screen;
  709.     SUBLCD_RedrawCategoryFunction = RedrawCategory302Screen;
  710.     SUBLCD_GetCategoryHistory = dummy_get_history;
  711.     SUBLCD_GetCategoryHistorySize = dummy_get_history_size;
  712.     RedrawCategory302Screen();
  713.     GDI_UNLOCK;
  714. #endif /* __MMI_SUBLCD__ */ 
  715. }
  716. /*****************************************************************************
  717.  * FUNCTION
  718.  *  ExitCategory302Screen
  719.  * DESCRIPTION
  720.  *  Exits the category302 screen
  721.  * PARAMETERS
  722.  *  void
  723.  * RETURNS
  724.  *  void
  725.  *****************************************************************************/
  726. void ExitCategory302Screen(void)
  727. {
  728. #ifdef __MMI_SUBLCD__
  729.     /*----------------------------------------------------------------*/
  730.     /* Local Variables                                                */
  731.     /*----------------------------------------------------------------*/
  732.     /*----------------------------------------------------------------*/
  733.     /* Code Body                                                      */
  734.     /*----------------------------------------------------------------*/
  735.     SUBLCD_ExitCategoryFunction = MMI_dummy_function;
  736.     SUBLCD_RedrawCategoryFunction = MMI_dummy_function;
  737.     SUBLCD_GetCategoryHistory = dummy_get_history;
  738.     SUBLCD_GetCategoryHistorySize = dummy_get_history_size;
  739. #endif /* __MMI_SUBLCD__ */ 
  740. }
  741. /*****************************************************************************
  742.  * FUNCTION
  743.  *  dm_category303_callback
  744.  * DESCRIPTION
  745.  *  
  746.  * PARAMETERS
  747.  *  coordinates     [?]     
  748.  * RETURNS
  749.  *  void
  750.  *****************************************************************************/
  751. void dm_category303_callback(dm_coordinates *coordinates)
  752. {
  753. #ifdef __MMI_SUBLCD__
  754.     /*----------------------------------------------------------------*/
  755.     /* Local Variables                                                */
  756.     /*----------------------------------------------------------------*/
  757.     /*----------------------------------------------------------------*/
  758.     /* Code Body                                                      */
  759.     /*----------------------------------------------------------------*/
  760. #ifdef __MMI_KLG__
  761.     gdi_draw_line(0, 54, UI_device_width - 1, 54, GDI_COLOR_WHITE);
  762. #else 
  763.     gdi_draw_line(0, 54, UI_device_width - 1, 54, GDI_COLOR_BLACK);
  764. #endif 
  765. #ifdef __MMI_SUBLCD_SHOW_WORLD_CLOCK__
  766.     gdi_layer_push_clip();
  767.     gdi_layer_reset_clip();
  768.     gui_set_font(&MMI_medium_font);
  769.     gui_set_text_color(c);
  770.     gui_measure_string(SUBLCD_MMI_message_string, &w, &h);
  771.     x = (UI_device_width >> 1) - (w >> 1);
  772.     if (r2lMMIFlag)
  773.     {
  774.         gui_move_text_cursor(x + w, sub_LCD_dt_object1.date.y + sub_LCD_dt_object1.date.height + 2);
  775.     }
  776.     else
  777.     {
  778.         gui_move_text_cursor(x, sub_LCD_dt_object1.date.y + sub_LCD_dt_object1.date.height + 2);
  779.     }
  780.     gui_print_text(SUBLCD_MMI_message_string);
  781.     gui_measure_string(SUBLCD_MMI_message_string1, &w, &h);
  782.     x = (UI_device_width >> 1) - (w >> 1);
  783.     if (r2lMMIFlag)
  784.     {
  785.         gui_move_text_cursor(x + w, sub_LCD_dt_object2.time.y - (h));
  786.     }
  787.     else
  788.     {
  789.         gui_move_text_cursor(x, sub_LCD_dt_object2.time.y - (h));
  790.     }
  791.     gui_print_text(SUBLCD_MMI_message_string1);
  792.     gdi_layer_pop_clip();
  793. #endif /* __MMI_SUBLCD_SHOW_WORLD_CLOCK__ */ 
  794. #endif /* __MMI_SUBLCD__ */ 
  795. }
  796. /*****************************************************************************
  797.  * FUNCTION
  798.  *  ShowCategory303Screen
  799.  * DESCRIPTION
  800.  *  Displays the category303 screen :- sub lcd screen display details of 2 cities on sublcd
  801.  * PARAMETERS
  802.  *  message1            [?]         
  803.  *  message2            [?]         
  804.  *  time_diff1          [IN]        
  805.  *  time_diff2          [IN]        
  806.  *  history_buffer      [IN]        History buffer
  807.  *  STRING(?)           [IN]        Second message to be displayed (City name2)
  808.  *  MYTIME(?)           [IN]        Time Difference for second City
  809.  * RETURNS
  810.  *  void
  811.  *****************************************************************************/
  812. void ShowCategory303Screen(U8 *message1, U8 *message2, FLOAT time_diff1, FLOAT time_diff2, U8 *history_buffer)
  813. {
  814. #ifdef __MMI_SUBLCD__
  815.     /*----------------------------------------------------------------*/
  816.     /* Local Variables                                                */
  817.     /*----------------------------------------------------------------*/
  818.     dm_data_struct dm_data;
  819.     /*----------------------------------------------------------------*/
  820.     /* Code Body                                                      */
  821.     /*----------------------------------------------------------------*/
  822. #ifdef __MMI_SUBLCD_SHOW_ANALOG_CLOCK__
  823.     if (!IsClamClose())
  824.     {
  825.         return;
  826.     }
  827. #endif /* __MMI_SUBLCD_SHOW_ANALOG_CLOCK__ */ 
  828.     GDI_LOCK;
  829.     SUBLCD_ExitCategoryFunction();
  830.     UI_set_sub_LCD_graphics_context();
  831.     gdi_layer_lock_frame_buffer();
  832.     set_sub_LCD_dt_date_hide_function(SUBLCD_screens_hide_date_time);
  833.     set_sub_LCD_dt_time_hide_function(SUBLCD_screens_hide_date_time);
  834. #ifdef __MMI_SUBLCD_SHOW_WORLD_CLOCK__
  835.     dt_difference1 = time_diff1;
  836.     dt_difference2 = time_diff2;
  837.     SUBLCD_MMI_message_string = (UI_string_type) message1;
  838.     SUBLCD_MMI_message_string1 = (UI_string_type) message2;
  839. #endif /* __MMI_SUBLCD_SHOW_WORLD_CLOCK__ */ 
  840.     set_dt_display(DT_SUBLCD_IDLE_SCREEN1);
  841.     register_hide_status_icon_bar(2, SUBLCD_screens_hide_status_icons);
  842.     show_status_icon_bar(2);
  843.     gdi_layer_unlock_frame_buffer();
  844.     SUBLCD_ExitCategoryFunction = ExitCategory303Screen;
  845.     SUBLCD_GetCategoryHistory = dummy_get_history;
  846.     SUBLCD_GetCategoryHistorySize = dummy_get_history_size;
  847.     SUBLCD_RedrawCategoryFunction = dm_sublcd_redraw_category_screen;
  848.     dm_register_sub_category_controlled_callback(dm_category303_callback);
  849.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  850.     dm_data.s32CatId = MMI_CATEGORY303_ID;
  851.     dm_data.s32flags = DM_SUB_LCD_CONTEXT;
  852.     dm_sublcd_setup_data(&dm_data);
  853.     dm_sublcd_redraw_category_screen();
  854.     UI_set_main_LCD_graphics_context();
  855.     GDI_UNLOCK;
  856. #endif /* __MMI_SUBLCD__ */ 
  857. }
  858. /*****************************************************************************
  859.  * FUNCTION
  860.  *  ExitCategory303Screen
  861.  * DESCRIPTION
  862.  *  Exits the category303 screen
  863.  * PARAMETERS
  864.  *  void
  865.  * RETURNS
  866.  *  void
  867.  *****************************************************************************/
  868. void ExitCategory303Screen(void)
  869. {
  870. #ifdef __MMI_SUBLCD__
  871.     /*----------------------------------------------------------------*/
  872.     /* Local Variables                                                */
  873.     /*----------------------------------------------------------------*/
  874.     /*----------------------------------------------------------------*/
  875.     /* Code Body                                                      */
  876.     /*----------------------------------------------------------------*/
  877.     UI_set_sub_LCD_graphics_context();
  878.     close_status_icons();
  879.     close_sub_LCD_dt_display();
  880.     UI_set_main_LCD_graphics_context();
  881. #endif /* __MMI_SUBLCD__ */ 
  882. }
  883. /*****************************************************************************
  884.  * FUNCTION
  885.  *  ShowCategory304Screen
  886.  * DESCRIPTION
  887.  *  Displays the category304 screen
  888.  * PARAMETERS
  889.  *  message_icon        [IN]        
  890.  *  history_buffer      [IN]        History buffer
  891.  *  MMI_ID_TYPE(?)      [IN]        Icon        Message icon
  892.  * RETURNS
  893.  *  void
  894.  *****************************************************************************/
  895. void ShowCategory304Screen(U16 message_icon, U8 *history_buffer)
  896. {
  897. #ifdef __MMI_SUBLCD__
  898.     /*----------------------------------------------------------------*/
  899.     /* Local Variables                                                */
  900.     /*----------------------------------------------------------------*/
  901.     dm_data_struct dm_data;
  902.     /*----------------------------------------------------------------*/
  903.     /* Code Body                                                      */
  904.     /*----------------------------------------------------------------*/
  905. #ifdef __MMI_SUBLCD_SHOW_ANALOG_CLOCK__
  906.     if (!IsClamClose())
  907.     {
  908.         return;
  909.     }
  910. #endif /* __MMI_SUBLCD_SHOW_ANALOG_CLOCK__ */ 
  911.     GDI_LOCK;
  912.     SUBLCD_ExitCategoryFunction();
  913.     UI_set_sub_LCD_graphics_context();
  914.     gdi_layer_lock_frame_buffer();
  915. #ifdef __MMI_SUBLCD_CHARGING_HIDE_STATUS_BAR__
  916.     hide_status_icon_bar(2);
  917. #else /* __MMI_SUBLCD_CHARGING_HIDE_STATUS_BAR__ */ 
  918.     register_hide_status_icon_bar(2, SUBLCD_screens_hide_status_icons);
  919.     show_status_icon_bar(2);
  920. #endif /* __MMI_SUBLCD_CHARGING_HIDE_STATUS_BAR__ */ 
  921.     gdi_layer_unlock_frame_buffer();
  922.     SUBLCD_ExitCategoryFunction = ExitCategory304Screen;
  923.     SUBLCD_GetCategoryHistory = dummy_get_history;
  924.     SUBLCD_GetCategoryHistorySize = dummy_get_history_size;
  925.     SUBLCD_RedrawCategoryFunction = dm_sublcd_redraw_category_screen;
  926.     dm_add_image(get_image(message_icon), NULL, NULL);
  927.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  928.     dm_data.s32CatId = MMI_CATEGORY304_ID;
  929.     dm_data.s32flags = DM_SUB_LCD_CONTEXT;
  930.     dm_sublcd_setup_data(&dm_data);
  931.     dm_sublcd_redraw_category_screen();
  932.     UI_set_main_LCD_graphics_context();
  933.     GDI_UNLOCK;
  934. #endif /* __MMI_SUBLCD__ */ 
  935. }
  936. /*****************************************************************************
  937.  * FUNCTION
  938.  *  ExitCategory304Screen
  939.  * DESCRIPTION
  940.  *  Exits the category304 screen
  941.  * PARAMETERS
  942.  *  void
  943.  * RETURNS
  944.  *  void
  945.  *****************************************************************************/
  946. void ExitCategory304Screen(void)
  947. {
  948. #ifdef __MMI_SUBLCD__
  949.     /*----------------------------------------------------------------*/
  950.     /* Local Variables                                                */
  951.     /*----------------------------------------------------------------*/
  952.     /*----------------------------------------------------------------*/
  953.     /* Code Body                                                      */
  954.     /*----------------------------------------------------------------*/
  955.     UI_set_sub_LCD_graphics_context();
  956.     close_status_icons();
  957.     UI_set_main_LCD_graphics_context();
  958. #endif /* __MMI_SUBLCD__ */ 
  959. }
  960. /*****************************************************************************
  961.  * FUNCTION
  962.  *  handle_category311_text_scroll
  963.  * DESCRIPTION
  964.  *  handle scrolling text on category311:- sub lcd screen
  965.  * PARAMETERS
  966.  *  void
  967.  * RETURNS
  968.  *  void
  969.  *****************************************************************************/
  970. void handle_category311_text_scroll(void)
  971. {
  972. #ifdef __MMI_SUBLCD__
  973.     /*----------------------------------------------------------------*/
  974.     /* Local Variables                                                */
  975.     /*----------------------------------------------------------------*/
  976.     GDI_HANDLE act_lcd = GDI_ERROR_HANDLE;
  977. #ifdef __MMI_KLG__
  978.     color bc = gui_color(255, 255, 255);
  979. #else 
  980.     color bc = gui_color(0, 0, 0);
  981. #endif 
  982.     /*----------------------------------------------------------------*/
  983.     /* Code Body                                                      */
  984.     /*----------------------------------------------------------------*/
  985.     GDI_LOCK;
  986.     gdi_lcd_get_active(&act_lcd);
  987.     UI_set_sub_LCD_graphics_context();
  988.     gdi_layer_push_clip();
  989.     gdi_layer_reset_clip();
  990.     gui_set_text_color(bc);
  991.     gui_set_font(current_MMI_theme->title_text_font);
  992.     if (r2lMMIFlag)
  993.     {
  994.         category311_text_offset_x += CATEGORY311_TEXT_SCROLL_SIZE;
  995.         if ((category311_text_offset_x + CATEGORY311_TEXT_SCROLL_X) >=
  996.             (category311_text_width + CATEGORY311_TEXT_SCROLL_GAP))
  997.         {
  998.             category311_text_offset_x = CATEGORY311_TEXT_SCROLL_X;
  999.         }
  1000.     }
  1001.     else
  1002.     {
  1003.         category311_text_offset_x -= CATEGORY311_TEXT_SCROLL_SIZE;
  1004.         if ((category311_text_offset_x + category311_text_width + CATEGORY311_TEXT_SCROLL_GAP) <
  1005.             CATEGORY311_TEXT_SCROLL_X)
  1006.         {
  1007.             category311_text_offset_x = CATEGORY311_TEXT_SCROLL_X;
  1008.         }
  1009.     }
  1010.     /* 102604 MTK Calvin modified becuase Thai_14 font is higher than CATEGORY311_TEXT_SCROLL_Y by 3 */
  1011. #if defined(__MMI_LANG_THAI__)
  1012.     show_sublcd_status_background(
  1013.         0,
  1014.         14 /* one pixel lower than icon bar */ ,
  1015.         (UI_device_width - 1),
  1016.         (CATEGORY311_TEXT_SCROLL_Y + category311_text_height + 2),
  1017.         MMI_FALSE);
  1018. #else /* defined(__MMI_LANG_THAI__) */ 
  1019.     show_sublcd_status_background(
  1020.         0,
  1021.         CATEGORY311_TEXT_SCROLL_Y,
  1022.         (UI_device_width - 1),
  1023.         (CATEGORY311_TEXT_SCROLL_Y + category311_text_height - 1),
  1024.         MMI_FALSE);
  1025. #endif /* defined(__MMI_LANG_THAI__) */ 
  1026.     /* MTK Calvin end */
  1027.     gui_move_text_cursor(category311_text_offset_x, CATEGORY311_TEXT_SCROLL_Y);
  1028.     gui_print_text(SUBLCD_MMI_message_string);
  1029.     if ((category311_text_offset_x + category311_text_width + CATEGORY311_TEXT_SCROLL_GAP) < UI_device_width)
  1030.     {
  1031.         if (r2lMMIFlag)
  1032.         {
  1033.             gui_move_text_cursor(
  1034.                 category311_text_offset_x - (category311_text_width + CATEGORY311_TEXT_SCROLL_GAP),
  1035.                 CATEGORY311_TEXT_SCROLL_Y);
  1036.         }
  1037.         else
  1038.         {
  1039.             gui_move_text_cursor(
  1040.                 category311_text_offset_x + category311_text_width + CATEGORY311_TEXT_SCROLL_GAP,
  1041.                 CATEGORY311_TEXT_SCROLL_Y);
  1042.         }
  1043.         gui_print_text(SUBLCD_MMI_message_string);
  1044.     }
  1045.     gdi_layer_pop_clip();
  1046.     gui_start_timer(CATEGORY311_TEXT_SCROLL_TIME, handle_category311_text_scroll);
  1047.     gdi_layer_blt_previous(
  1048.         0,
  1049.         CATEGORY311_TEXT_SCROLL_Y,
  1050.         UI_device_width - 1,
  1051.         CATEGORY311_TEXT_SCROLL_Y + category311_text_height - 1);
  1052.     if (act_lcd == GDI_LCD_MAIN_LCD_HANDLE)
  1053.     {
  1054.         UI_set_main_LCD_graphics_context();
  1055.     }
  1056.     GDI_UNLOCK;
  1057. #endif /* __MMI_SUBLCD__ */ 
  1058. }
  1059. /*****************************************************************************
  1060.  * FUNCTION
  1061.  *  dm_category311_callback
  1062.  * DESCRIPTION
  1063.  *  
  1064.  * PARAMETERS
  1065.  *  coordinates     [?]     
  1066.  * RETURNS
  1067.  *  void
  1068.  *****************************************************************************/
  1069. void dm_category311_callback(dm_coordinates *coordinates)
  1070. {
  1071. #ifdef __MMI_SUBLCD__
  1072.     /*----------------------------------------------------------------*/
  1073.     /* Local Variables                                                */
  1074.     /*----------------------------------------------------------------*/
  1075.     /*----------------------------------------------------------------*/
  1076.     /* Code Body                                                      */
  1077.     /*----------------------------------------------------------------*/
  1078.     if (SUBLCD_MMI_message_string)
  1079.     {
  1080.         color bc = gui_color(0, 0, 0);
  1081.         S32 w, x, y = CATEGORY311_TEXT_SCROLL_Y;
  1082.         gui_set_text_color(bc);
  1083.         gui_set_font(current_MMI_theme->title_text_font);
  1084.         gui_measure_string(SUBLCD_MMI_message_string, &w, &category311_text_height);
  1085.         if (w < UI_device_width)
  1086.         {
  1087.             x = (UI_device_width >> 1) - (w >> 1);
  1088.         }
  1089.         else
  1090.         {
  1091.             category311_text_width = w;
  1092.             x = category311_text_offset_x = CATEGORY311_TEXT_SCROLL_X;
  1093.             gui_start_timer(CATEGORY311_TEXT_SCROLL_WAIT, handle_category311_text_scroll);
  1094.         }
  1095.         if (r2lMMIFlag)
  1096.         {
  1097.             gui_move_text_cursor(x + w, y);
  1098.         }
  1099.         else
  1100.         {
  1101.             gui_move_text_cursor(x, y);
  1102.         }
  1103.         gui_print_text(SUBLCD_MMI_message_string);
  1104.         coordinates->s16X = UI_device_width >> 1;
  1105.         coordinates->s16Y = 40;
  1106.         coordinates->s16Width = 0;
  1107.         coordinates->s16Height = 0;
  1108.     }
  1109.     else
  1110.     {
  1111.         coordinates->s16X = UI_device_width >> 1;
  1112.         coordinates->s16Y = UI_device_height >> 1;
  1113.         coordinates->s16Width = 0;
  1114.         coordinates->s16Height = 0;
  1115.     }
  1116. #endif /* __MMI_SUBLCD__ */ 
  1117. }
  1118. /*****************************************************************************
  1119.  * FUNCTION
  1120.  *  ShowCategory311Screen
  1121.  * DESCRIPTION
  1122.  *  Displays the category311 screen:- dispaly the mesage and icon on sublcd
  1123.  *  if text s longer than sublcd witdth then scroll text
  1124.  * PARAMETERS
  1125.  *  message             [IN]        Message string
  1126.  *  message_icon        [IN]        
  1127.  *  history_buffer      [IN]        History buffer
  1128.  *  MMI_ID_TYPE(?)      [IN]        Icon        Message icon
  1129.  * RETURNS
  1130.  *  void
  1131.  *****************************************************************************/
  1132. void ShowCategory311Screen(U8 *message, U16 message_icon, U8 *history_buffer)
  1133. {
  1134. #ifdef __MMI_SUBLCD__
  1135.     /*----------------------------------------------------------------*/
  1136.     /* Local Variables                                                */
  1137.     /*----------------------------------------------------------------*/
  1138.     dm_data_struct dm_data;
  1139.     /*----------------------------------------------------------------*/
  1140.     /* Code Body                                                      */
  1141.     /*----------------------------------------------------------------*/
  1142. #ifdef __MMI_SUBLCD_SHOW_ANALOG_CLOCK__
  1143.     if (!IsClamClose())
  1144.     {
  1145.         return;
  1146.     }
  1147. #endif /* __MMI_SUBLCD_SHOW_ANALOG_CLOCK__ */ 
  1148.     GDI_LOCK;
  1149.     SUBLCD_ExitCategoryFunction();
  1150.     UI_set_sub_LCD_graphics_context();
  1151.     gdi_layer_lock_frame_buffer();
  1152.     SUBLCD_MMI_message_string = (UI_string_type) message;
  1153.     register_hide_status_icon_bar(2, SUBLCD_screens_hide_status_icons);
  1154.     show_status_icon_bar(2);
  1155.     gdi_layer_unlock_frame_buffer();
  1156.     SUBLCD_ExitCategoryFunction = ExitCategory311Screen;
  1157.     SUBLCD_GetCategoryHistory = dummy_get_history;
  1158.     SUBLCD_GetCategoryHistorySize = dummy_get_history_size;
  1159.     SUBLCD_RedrawCategoryFunction = dm_sublcd_redraw_category_screen;
  1160.     dm_register_sub_category_controlled_callback(dm_category311_callback);
  1161.     dm_add_image(get_image(message_icon), NULL, NULL);
  1162.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  1163.     dm_data.s32CatId = MMI_CATEGORY311_ID;
  1164.     dm_data.s32flags = DM_SUB_LCD_CONTEXT;
  1165.     dm_sublcd_setup_data(&dm_data);
  1166.     dm_sublcd_redraw_category_screen();
  1167.     UI_set_main_LCD_graphics_context();
  1168.     GDI_UNLOCK;
  1169. #endif /* __MMI_SUBLCD__ */ 
  1170. }
  1171. /*****************************************************************************
  1172.  * FUNCTION
  1173.  *  ExitCategory311Screen
  1174.  * DESCRIPTION
  1175.  *  Exits the category311 screen
  1176.  * PARAMETERS
  1177.  *  void
  1178.  * RETURNS
  1179.  *  void
  1180.  *****************************************************************************/
  1181. void ExitCategory311Screen(void)
  1182. {
  1183. #ifdef __MMI_SUBLCD__
  1184.     /*----------------------------------------------------------------*/
  1185.     /* Local Variables                                                */
  1186.     /*----------------------------------------------------------------*/
  1187.     /*----------------------------------------------------------------*/
  1188.     /* Code Body                                                      */
  1189.     /*----------------------------------------------------------------*/
  1190.     UI_set_sub_LCD_graphics_context();
  1191.     gui_cancel_timer(handle_category311_text_scroll);
  1192.     close_status_icons();
  1193.     UI_set_main_LCD_graphics_context();
  1194. #endif /* __MMI_SUBLCD__ */ 
  1195. }
  1196. #ifdef __MMI_SUB_WALLPAPER__
  1197. /*****************************************************************************
  1198.  * FUNCTION
  1199.  *  SUBLCD_UpdateWallpaper
  1200.  * DESCRIPTION
  1201.  *  a function to update sublcd wallpaper
  1202.  * PARAMETERS
  1203.  *  void
  1204.  * RETURNS
  1205.  *  void
  1206.  *****************************************************************************/
  1207. void SUBLCD_UpdateWallpaper(void)
  1208. {
  1209.     /*----------------------------------------------------------------*/
  1210.     /* Local Variables                                                */
  1211.     /*----------------------------------------------------------------*/
  1212.     gdi_handle act_lcd_handle;
  1213.     GDI_RESULT ret = 0;
  1214.     /*----------------------------------------------------------------*/
  1215.     /* Code Body                                                      */
  1216.     /*----------------------------------------------------------------*/
  1217.     if (sublcd_wallpaper_layer == NULL || *sublcd_wallpaper_layer == GDI_ERROR_HANDLE)
  1218.     {
  1219.         return;
  1220.     }
  1221.     gdi_lcd_get_active(&act_lcd_handle);
  1222.     if (act_lcd_handle != GDI_LCD_SUB_LCD_HANDLE)
  1223.     {
  1224.         UI_set_sub_LCD_graphics_context();
  1225.     }
  1226.     gdi_layer_push_and_set_active(*sublcd_wallpaper_layer);
  1227.     gdi_layer_clear(GDI_COLOR_TRANSPARENT);
  1228.     gdi_layer_push_clip();
  1229.     gdi_layer_reset_clip();
  1230.     /* stop previous animations, if any */
  1231.     if (sublcd_wallpaper_animation_handle != GDI_ERROR_HANDLE)
  1232.     {
  1233.         gdi_image_stop_animation(sublcd_wallpaper_animation_handle);
  1234.         sublcd_wallpaper_animation_handle = GDI_ERROR_HANDLE;
  1235.     }
  1236.     /* from resource */
  1237.     if (idle_screen_wallpaper_sub_ID != 0)
  1238.     {
  1239.         gdi_image_draw_animation_id(
  1240.             cat312_image_x,
  1241.             cat312_image_y,
  1242.             idle_screen_wallpaper_sub_ID,
  1243.             &sublcd_wallpaper_animation_handle);
  1244.     }
  1245.     /* from file */
  1246.     else
  1247.     {
  1248.         gdi_image_get_dimension_file((S8*) idle_screen_wallpaper_sub_name, &cat312_image_width, &cat312_image_height);
  1249.         /* the image is larger than screen size */
  1250.         if (cat312_image_width > SUB_LCD_device_width || cat312_image_height > SUB_LCD_device_height)
  1251.         {
  1252.             S32 resized_offset_x;
  1253.             S32 resized_offset_y;
  1254.             S32 resized_width;
  1255.             S32 resized_height;
  1256.             U16 img_type;
  1257.             gdi_image_util_fit_bbox(
  1258.                 SUB_LCD_device_width,
  1259.                 SUB_LCD_device_height,
  1260.                 cat312_image_width,
  1261.                 cat312_image_height,
  1262.                 &resized_offset_x,
  1263.                 &resized_offset_y,
  1264.                 &resized_width,
  1265.                 &resized_height);
  1266.             img_type = gdi_image_get_type_from_file((PS8) idle_screen_wallpaper_sub_name);
  1267.             /* only resize jpg files !! */
  1268.             /* will take lots ot time to resize images of other format */
  1269.             /* for images of other formats, try to set center alignment */
  1270.             if (img_type == GDI_IMAGE_TYPE_JPG_FILE)
  1271.             {
  1272.                 cat312_image_x = resized_offset_x;
  1273.                 cat312_image_y = resized_offset_y;
  1274.                 ret = gdi_image_draw_resized_file(
  1275.                         resized_offset_x,
  1276.                         resized_offset_y,
  1277.                         resized_width,
  1278.                         resized_height,
  1279.                         (PS8) idle_screen_wallpaper_sub_name);
  1280.             }
  1281.             else
  1282.             {
  1283.                 if (SUB_LCD_device_width > cat312_image_width)  /* the image is higher than screen */
  1284.                 {
  1285.                     cat312_image_x = (SUB_LCD_device_width - cat312_image_width) >> 1;
  1286.                 }
  1287.                 else    /* the image is wider than screen */
  1288.                 {
  1289.                     cat312_image_y = (SUB_LCD_device_height - cat312_image_height) >> 1;
  1290.                 }
  1291.                 ret = gdi_image_draw_file(cat312_image_x, cat312_image_y, (PS8) idle_screen_wallpaper_sub_name);
  1292.             }
  1293.         }
  1294.         else
  1295.         {
  1296.             ret = gdi_image_draw_animation_file((SUB_LCD_device_width - cat312_image_width) >> 1, (SUB_LCD_device_height - cat312_image_height) >> 1, idle_screen_wallpaper_sub_name, &sublcd_wallpaper_animation_handle);      /* diamond, 2005/05/09 for sub-LCD wallpaper */
  1297.         }
  1298.     }
  1299.     gdi_layer_pop_clip();
  1300.     gdi_layer_pop_and_restore_active();
  1301.     gdi_layer_blt(*sublcd_wallpaper_layer, sublcd_base_layer, 0, 0, 0, 0, UI_device_width - 1, UI_device_height - 1);
  1302.     if (act_lcd_handle == GDI_LCD_MAIN_LCD_HANDLE)
  1303.     {
  1304.         UI_set_main_LCD_graphics_context();
  1305.     }
  1306.     /* diamond, 2005/06/09 bad file callback */
  1307.     if (ret < 0 && ret != GDI_GIF_ERR_OUT_OF_CLIP_REGION && ret != GDI_BMP_ERR_OUT_OF_CLIP_REGION)
  1308.     {
  1309.         PRINT_INFORMATION_2((MMI_TRACE_G7_MISC, "SUBLCD_UpdateWallpaper():[$$$]GDI_RESULT:%d[$$$]n", ret));
  1310.         PhnsetWallpaperSubBadFileCallBack(0);
  1311.         gdi_image_draw_animation_id(
  1312.             cat312_image_x,
  1313.             cat312_image_y,
  1314.             idle_screen_wallpaper_sub_ID,
  1315.             &sublcd_wallpaper_animation_handle);
  1316.     }
  1317.     /* end, diamond */
  1318. }
  1319. /*****************************************************************************
  1320.  * FUNCTION
  1321.  *  SUBLCD_SetIdleScreenWallpaperID
  1322.  * DESCRIPTION
  1323.  *  
  1324.  * PARAMETERS
  1325.  *  image_ID        [IN]        
  1326.  * RETURNS
  1327.  *  void
  1328.  *****************************************************************************/
  1329. void SUBLCD_SetIdleScreenWallpaperID(U16 image_ID)
  1330. {
  1331.     /*----------------------------------------------------------------*/
  1332.     /* Local Variables                                                */
  1333.     /*----------------------------------------------------------------*/
  1334.     /*----------------------------------------------------------------*/
  1335.     /* Code Body                                                      */
  1336.     /*----------------------------------------------------------------*/
  1337.     idle_screen_wallpaper_sub_ID = image_ID;
  1338.     gdi_image_get_dimension_id(idle_screen_wallpaper_sub_ID, &cat312_image_width, &cat312_image_height);
  1339.     cat312_image_x = (SUB_LCD_device_width >> 1) - (cat312_image_width >> 1);
  1340.     cat312_image_y = (SUB_LCD_device_height >> 1) - (cat312_image_height >> 1);
  1341. }
  1342. /*****************************************************************************
  1343.  * FUNCTION
  1344.  *  SUBLCD_SetIdleScreenWallpaperName
  1345.  * DESCRIPTION
  1346.  *  
  1347.  * PARAMETERS
  1348.  *  name        [IN]        
  1349.  * RETURNS
  1350.  *  void
  1351.  *****************************************************************************/
  1352. void SUBLCD_SetIdleScreenWallpaperName(UI_string_type name)
  1353. {
  1354.     /*----------------------------------------------------------------*/
  1355.     /* Local Variables                                                */
  1356.     /*----------------------------------------------------------------*/
  1357.     /*----------------------------------------------------------------*/
  1358.     /* Code Body                                                      */
  1359.     /*----------------------------------------------------------------*/
  1360.     idle_screen_wallpaper_sub_ID = 0;
  1361.     pfnUnicodeStrcpy(idle_screen_wallpaper_sub_name, (S8*) name);
  1362.     /* since image size is unknown, just set image_x, image_y to 0 */
  1363.     /* when display the image, we will calculate image_x, image_y */
  1364.     cat312_image_x = 0;
  1365.     cat312_image_y = 0;
  1366. }
  1367. /*****************************************************************************
  1368.  * FUNCTION
  1369.  *  SUBLCD_CheckWallpaperFrameCount
  1370.  * DESCRIPTION
  1371.  *  to check if the image frame out of limit
  1372.  * PARAMETERS
  1373.  *  name        [IN]        Image path
  1374.  * RETURNS
  1375.  *  void
  1376.  *****************************************************************************/
  1377. BOOL SUBLCD_CheckWallpaperFrameCount(UI_string_type name)
  1378. {
  1379.     /*----------------------------------------------------------------*/
  1380.     /* Local Variables                                                */
  1381.     /*----------------------------------------------------------------*/
  1382.     S32 cat33_n_frames = 0;
  1383.     /*----------------------------------------------------------------*/
  1384.     /* Code Body                                                      */
  1385.     /*----------------------------------------------------------------*/
  1386.     gdi_image_gif_get_frame_count_file((S8*) name, &cat33_n_frames);
  1387.     if (cat33_n_frames > MAX_SUB_WALLPAPER_FRAME)
  1388.     {
  1389.         return MMI_FALSE;
  1390.     }
  1391.     else
  1392.     {
  1393.         return MMI_TRUE;
  1394.     }
  1395. }
  1396. /*****************************************************************************
  1397.  * FUNCTION
  1398.  *  cat312_hide_time_display
  1399.  * DESCRIPTION
  1400.  *  hide function of time display of analog/digital  clock
  1401.  * PARAMETERS
  1402.  *  x1      [IN]        Start x position
  1403.  *  y1      [IN]        Start y position
  1404.  *  x2      [IN]        End x position
  1405.  *  y2      [IN]        End y position
  1406.  * RETURNS
  1407.  *  void
  1408.  *****************************************************************************/
  1409. void cat312_hide_time_display(S32 x1, S32 y1, S32 x2, S32 y2)
  1410. {
  1411.     /*----------------------------------------------------------------*/
  1412.     /* Local Variables                                                */
  1413.     /*----------------------------------------------------------------*/
  1414.     /*----------------------------------------------------------------*/
  1415.     /* Code Body                                                      */
  1416.     /*----------------------------------------------------------------*/
  1417.     gdi_layer_push_and_set_active(sublcd_base_layer);
  1418.     gdi_layer_push_clip();
  1419.     gdi_layer_reset_clip();
  1420.     gdi_draw_solid_rect(x1, y1, x2, y2, GDI_COLOR_TRANSPARENT);
  1421.     gdi_layer_pop_clip();
  1422.     gdi_layer_pop_and_restore_active();
  1423. }
  1424. /*****************************************************************************
  1425.  * FUNCTION
  1426.  *  cat312_hide_status_icon_bar
  1427.  * DESCRIPTION
  1428.  *  hide function of status icon bar
  1429.  * PARAMETERS
  1430.  *  void
  1431.  *  S32(?)      [IN]        Y2      :- end y position
  1432.  * RETURNS
  1433.  *  void
  1434.  *****************************************************************************/
  1435. void cat312_hide_status_icon_bar(void)
  1436. {
  1437.     /*----------------------------------------------------------------*/
  1438.     /* Local Variables                                                */
  1439.     /*----------------------------------------------------------------*/
  1440.     /*----------------------------------------------------------------*/
  1441.     /* Code Body                                                      */
  1442.     /*----------------------------------------------------------------*/
  1443.     gdi_layer_push_and_set_active(sublcd_base_layer);
  1444.     gdi_layer_push_clip();
  1445.     gdi_layer_set_clip(
  1446.         MMI_status_icon_bars[2].x1,
  1447.         MMI_status_icon_bars[2].y1,
  1448.         MMI_status_icon_bars[2].x2,
  1449.         MMI_status_icon_bars[2].y2);
  1450.     gdi_draw_solid_rect(
  1451.         MMI_status_icon_bars[2].x1,
  1452.         MMI_status_icon_bars[2].y1,
  1453.         MMI_status_icon_bars[2].x2,
  1454.         MMI_status_icon_bars[2].y2,
  1455.         GDI_COLOR_TRANSPARENT);
  1456.     gdi_layer_pop_clip();
  1457.     gdi_layer_pop_and_restore_active();
  1458. }
  1459. #endif /* __MMI_SUB_WALLPAPER__ */ 
  1460. /*****************************************************************************
  1461.  * FUNCTION
  1462.  *  ShowCategory312Screen
  1463.  * DESCRIPTION
  1464.  *  Displays the category312 screen:- show one city detail on sub lcd screen
  1465.  *  [1] STRING     message to be displayed
  1466.  *  [2]   MYTIME      time difference
  1467.  * PARAMETERS
  1468.  *  message             [?]         
  1469.  *  time_diff_312       [IN]        
  1470.  *  history_buffer      [IN]        History buffer
  1471.  * RETURNS
  1472.  *  void
  1473.  *****************************************************************************/
  1474. void ShowCategory312Screen(U8 *message, FLOAT time_diff_312, U8 *history_buffer)
  1475. {
  1476. #ifdef __MMI_SUBLCD__
  1477.     /*----------------------------------------------------------------*/
  1478.     /* Local Variables                                                */
  1479.     /*----------------------------------------------------------------*/
  1480.     dm_data_struct dm_data;
  1481. #ifdef __MMI_SUB_WALLPAPER__
  1482.     GDI_RESULT create_sublcd_wallpaer_layer_fail = 1;
  1483. #endif 
  1484.     /*----------------------------------------------------------------*/
  1485.     /* Code Body                                                      */
  1486.     /*----------------------------------------------------------------*/
  1487. #ifdef __MMI_SUBLCD_SHOW_ANALOG_CLOCK__
  1488.     if (!IsClamClose())
  1489.     {
  1490.         return;
  1491.     }
  1492. #endif /* __MMI_SUBLCD_SHOW_ANALOG_CLOCK__ */ 
  1493.     GDI_LOCK;
  1494. #ifdef __MMI_SUB_WALLPAPER__
  1495.     if (SUBLCD_ExitCategoryFunction != ExitCategory312Screen)
  1496. #endif 
  1497.         SUBLCD_ExitCategoryFunction();
  1498. #ifdef __MMI_SUB_WALLPAPER__
  1499.     is_sub_idle_screen = MMI_TRUE;
  1500. #endif 
  1501.     UI_set_sub_LCD_graphics_context();
  1502.     gdi_layer_lock_frame_buffer();
  1503. #ifdef __MMI_SUB_WALLPAPER__
  1504.     set_sub_LCD_dt_date_hide_function(cat312_hide_time_display);
  1505.     set_sub_LCD_dt_time_hide_function(cat312_hide_time_display);
  1506. #else /* __MMI_SUB_WALLPAPER__ */ 
  1507.     set_sub_LCD_dt_date_hide_function(SUBLCD_screens_hide_date_time);
  1508.     set_sub_LCD_dt_time_hide_function(SUBLCD_screens_hide_date_time);
  1509. #endif /* __MMI_SUB_WALLPAPER__ */ 
  1510. #ifdef __MMI_SUBLCD_SHOW_WORLD_CLOCK__
  1511.     dt_difference1 = time_diff_312;
  1512.     SUBLCD_MMI_message_string = (UI_string_type) message;
  1513.     dm_add_string(message, &MMI_medium_font, UI_COLOR_BLACK, UI_COLOR_WHITE, NULL);
  1514. #else /* __MMI_SUBLCD_SHOW_WORLD_CLOCK__ */ 
  1515.     dm_add_string(NULL, &MMI_medium_font, UI_COLOR_BLACK, UI_COLOR_WHITE, NULL);
  1516. #endif /* __MMI_SUBLCD_SHOW_WORLD_CLOCK__ */ 
  1517. #ifdef __MMI_KLG__
  1518.     set_dt_display(DT_SUBLCD_IDLE_SCREEN4);
  1519. #else /* __MMI_KLG__ */ 
  1520. #ifdef __MMI_SUBLCD_L_TIME_M_DATE_1__
  1521.     set_dt_display(DT_SUBLCD_IDLE_SCREEN3);
  1522. #else 
  1523.     set_dt_display(DT_SUBLCD_IDLE_SCREEN2);
  1524. #endif 
  1525. #endif /* __MMI_KLG__ */ 
  1526. #if (defined __MMI_SUB_WALLPAPER__)
  1527.     {
  1528.         /* get base layer as skin layer */
  1529.         gdi_layer_get_base_handle(&sublcd_base_layer);
  1530.         if (sublcd_wallpaper_layer == NULL || *sublcd_wallpaper_layer == GDI_ERROR_HANDLE)
  1531.         {
  1532.             gdi_layer_get_base_handle(&sublcd_base_layer);
  1533.             gdi_layer_push_and_set_active(sublcd_base_layer);
  1534.             gdi_layer_set_source_key(TRUE, GDI_COLOR_TRANSPARENT);
  1535.             gdi_layer_clear_background(GDI_COLOR_TRANSPARENT);
  1536.             gdi_layer_pop_and_restore_active();
  1537.             if (dm_create_layer_using_outside_memory(
  1538.                     0,
  1539.                     0,
  1540.                     UI_device_width,
  1541.                     UI_device_height,
  1542.                     &sublcd_wallpaper_layer,
  1543.                     (U8*) sub_wallpaper_buf,
  1544.                     GDI_SUBLCD_WIDTH * GDI_SUBLCD_HEIGHT * GDI_SUBLCD_BIT_PER_PIXEL,
  1545.                     DM_LAYER_BOTTOM) != GDI_LAYER_SUCCEED)
  1546.             {
  1547.                 create_sublcd_wallpaer_layer_fail = 0;
  1548.             }
  1549.             MMI_ASSERT(create_sublcd_wallpaer_layer_fail);
  1550.             gdi_layer_push_and_set_active(*sublcd_wallpaper_layer);
  1551.             gdi_layer_set_source_key(TRUE, GDI_COLOR_TRANSPARENT);
  1552.             gdi_layer_pop_and_restore_active();
  1553.             SUBLCD_UpdateWallpaper();
  1554.         }
  1555.     }
  1556. #endif /* (defined __MMI_SUB_WALLPAPER__) */ 
  1557. #ifdef __MMI_SUB_WALLPAPER__
  1558.     register_hide_status_icon_bar(2, cat312_hide_status_icon_bar);
  1559. #else 
  1560.     register_hide_status_icon_bar(2, SUBLCD_screens_hide_status_icons);
  1561. #endif 
  1562.     show_status_icon_bar(2);
  1563.     gdi_layer_unlock_frame_buffer();
  1564.     SUBLCD_ExitCategoryFunction = ExitCategory312Screen;
  1565.     SUBLCD_GetCategoryHistory = dummy_get_history;
  1566.     SUBLCD_GetCategoryHistorySize = dummy_get_history_size;
  1567.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  1568.     dm_data.s32CatId = MMI_CATEGORY312_ID;
  1569.     dm_data.s32flags = DM_SUB_LCD_CONTEXT | DM_SUB_LCD_TRANSPARENT_BG;
  1570.     dm_sublcd_setup_data(&dm_data);
  1571.     SUBLCD_RedrawCategoryFunction = dm_sublcd_redraw_category_screen;
  1572.     dm_sublcd_redraw_category_screen();
  1573.     UI_set_main_LCD_graphics_context();
  1574.     GDI_UNLOCK;
  1575. #endif /* __MMI_SUBLCD__ */ 
  1576. }
  1577. /*****************************************************************************
  1578.  * FUNCTION
  1579.  *  ExitCategory312Screen
  1580.  * DESCRIPTION
  1581.  *  Exits the category312 screen
  1582.  * PARAMETERS
  1583.  *  void
  1584.  * RETURNS
  1585.  *  void
  1586.  *****************************************************************************/
  1587. void ExitCategory312Screen(void)
  1588. {
  1589. #ifdef __MMI_SUBLCD__
  1590.     /*----------------------------------------------------------------*/
  1591.     /* Local Variables                                                */
  1592.     /*----------------------------------------------------------------*/
  1593.     /*----------------------------------------------------------------*/
  1594.     /* Code Body                                                      */
  1595.     /*----------------------------------------------------------------*/
  1596.     UI_set_sub_LCD_graphics_context();
  1597.     close_status_icons();
  1598.     register_hide_status_icon_bar(2, SUBLCD_screens_hide_status_icons);
  1599.     close_sub_LCD_dt_display();
  1600. #ifdef __MMI_SUB_WALLPAPER__
  1601.     is_sub_idle_screen = MMI_FALSE;
  1602.     gdi_layer_set_blt_layer(sublcd_base_layer, 0, 0, 0);
  1603.     if ( sublcd_wallpaper_animation_handle != GDI_ERROR_HANDLE )
  1604.     {
  1605.         gdi_image_stop_animation(sublcd_wallpaper_animation_handle);
  1606.         sublcd_wallpaper_animation_handle = GDI_ERROR_HANDLE;
  1607.     }
  1608. #endif /* __MMI_SUB_WALLPAPER__ */ 
  1609.     UI_set_main_LCD_graphics_context();
  1610. #endif /* __MMI_SUBLCD__ */ 
  1611. }
  1612. /*****************************************************************************
  1613.  * FUNCTION
  1614.  *  ShowCategory313Screen
  1615.  * DESCRIPTION
  1616.  *  Displays the category313 screen
  1617.  * PARAMETERS
  1618.  *  message_icon        [IN]        
  1619.  *  history_buffer      [IN]        
  1620.  *  MMI_ID_TYPE(?)      [IN]        Icon
  1621.  * RETURNS
  1622.  *  void
  1623.  *****************************************************************************/
  1624. void ShowCategory313Screen(U16 message_icon, U8 *history_buffer)
  1625. {
  1626. #ifdef __MMI_SUBLCD__
  1627.     /*----------------------------------------------------------------*/
  1628.     /* Local Variables                                                */
  1629.     /*----------------------------------------------------------------*/
  1630.     dm_data_struct dm_data;
  1631.     /*----------------------------------------------------------------*/
  1632.     /* Code Body                                                      */
  1633.     /*----------------------------------------------------------------*/
  1634. #ifdef __MMI_SUBLCD_SHOW_ANALOG_CLOCK__
  1635.     if (!IsClamClose())
  1636.     {
  1637.         return;
  1638.     }
  1639. #endif /* __MMI_SUBLCD_SHOW_ANALOG_CLOCK__ */ 
  1640.     GDI_LOCK;
  1641.     SUBLCD_ExitCategoryFunction();
  1642.     UI_set_sub_LCD_graphics_context();
  1643.     hide_status_icon_bar(2);
  1644.     SUBLCD_ExitCategoryFunction = ExitCategory313Screen;
  1645.     SUBLCD_GetCategoryHistory = dummy_get_history;
  1646.     SUBLCD_GetCategoryHistorySize = dummy_get_history_size;
  1647.     SUBLCD_RedrawCategoryFunction = dm_sublcd_redraw_category_screen;
  1648.     dm_add_image(get_image(message_icon), NULL, NULL);
  1649.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  1650.     dm_data.s32CatId = MMI_CATEGORY313_ID;
  1651.     dm_data.s32flags = DM_SUB_LCD_CONTEXT;
  1652.     dm_sublcd_setup_data(&dm_data);
  1653.     dm_sublcd_redraw_category_screen();
  1654.     UI_set_main_LCD_graphics_context();
  1655.     GDI_UNLOCK;
  1656. #endif /* __MMI_SUBLCD__ */ 
  1657. }
  1658. /*****************************************************************************
  1659.  * FUNCTION
  1660.  *  ExitCategory313Screen
  1661.  * DESCRIPTION
  1662.  *  Exits the category313 screen
  1663.  * PARAMETERS
  1664.  *  void
  1665.  * RETURNS
  1666.  *  void
  1667.  *****************************************************************************/
  1668. void ExitCategory313Screen(void)
  1669. {
  1670.     /*----------------------------------------------------------------*/
  1671.     /* Local Variables                                                */
  1672.     /*----------------------------------------------------------------*/
  1673.     /*----------------------------------------------------------------*/
  1674.     /* Code Body                                                      */
  1675.     /*----------------------------------------------------------------*/
  1676. }
  1677. /*****************************************************************************
  1678.  * FUNCTION
  1679.  *  gui_rotate_180_sublcd
  1680.  * DESCRIPTION
  1681.  *  
  1682.  * PARAMETERS
  1683.  *  void
  1684.  * RETURNS
  1685.  *  void
  1686.  *****************************************************************************/
  1687. void gui_rotate_180_sublcd(void)
  1688. {
  1689. #ifdef __MMI_SUBLCD__
  1690.     /*----------------------------------------------------------------*/
  1691.     /* Local Variables                                                */
  1692.     /*----------------------------------------------------------------*/
  1693.     U16 value1, value2;
  1694.     U16 x1, y1, x2, y2;
  1695.     U32 counter = GDI_LAYER.act_rows * GDI_LAYER.act_pitch / 2;
  1696.     /*----------------------------------------------------------------*/
  1697.     /* Code Body                                                      */
  1698.     /*----------------------------------------------------------------*/
  1699.     for (y1 = 0, y2 = GDI_LAYER.act_rows - 1; y1 < GDI_LAYER.act_rows; y1++, y2--)
  1700.     {
  1701.         for (x1 = 0, x2 = GDI_LAYER.act_pitch - 1; x1 < GDI_LAYER.act_pitch; x1++, x2--)
  1702.         {
  1703.             if ((counter--) == 0)
  1704.             {
  1705.                 return;
  1706.             }
  1707.             GDI_SUBLCD_GET_BUFFER_PIXEL(x1, y1, value1);
  1708.             GDI_SUBLCD_GET_BUFFER_PIXEL(x2, y2, value2);
  1709.             GDI_SUBLCD_SET_BUFFER_PIXEL(x1, y1, !value2);
  1710.             GDI_SUBLCD_SET_BUFFER_PIXEL(x2, y2, !value1);
  1711.         }
  1712.     }
  1713. #endif /* __MMI_SUBLCD__ */ 
  1714. }
  1715. #ifdef __MMI_SUBLCD__
  1716. /*****************************************************************************
  1717.  * FUNCTION
  1718.  *  RedrawSubLCDAnalogClockScreen
  1719.  * DESCRIPTION
  1720.  *  
  1721.  * PARAMETERS
  1722.  *  void
  1723.  * RETURNS
  1724.  *  void
  1725.  *****************************************************************************/
  1726. void RedrawSubLCDAnalogClockScreen(void)
  1727. {
  1728.     /*----------------------------------------------------------------*/
  1729.     /* Local Variables                                                */
  1730.     /*----------------------------------------------------------------*/
  1731.     GDI_HANDLE act_lcd = GDI_ERROR_HANDLE;
  1732.     /*----------------------------------------------------------------*/
  1733.     /* Code Body                                                      */
  1734.     /*----------------------------------------------------------------*/
  1735.     gdi_lcd_get_active(&act_lcd);
  1736.     UI_set_sub_LCD_graphics_context();
  1737.     gdi_layer_lock_frame_buffer();
  1738.     gdi_layer_push_clip();
  1739.     gdi_layer_reset_clip();
  1740.     gdi_image_draw(0, 0, get_image(IMG_SUBLCD_ANALOG_CLOCK));
  1741.     show_analog_clock();
  1742.     gdi_layer_pop_clip();
  1743.     gdi_layer_unlock_frame_buffer();
  1744.     gdi_layer_blt_previous(0, 0, UI_device_width - 1, UI_device_height - 1);
  1745.     if (act_lcd == GDI_LCD_MAIN_LCD_HANDLE)
  1746.     {
  1747.         UI_set_main_LCD_graphics_context();
  1748.     }
  1749. }
  1750. /*****************************************************************************
  1751.  * FUNCTION
  1752.  *  ExitSubLCDAnalogClockScreen
  1753.  * DESCRIPTION
  1754.  *  
  1755.  * PARAMETERS
  1756.  *  void
  1757.  * RETURNS
  1758.  *  void
  1759.  *****************************************************************************/
  1760. void ExitSubLCDAnalogClockScreen(void)
  1761. {
  1762.     /*----------------------------------------------------------------*/
  1763.     /* Local Variables                                                */
  1764.     /*----------------------------------------------------------------*/
  1765.     /*----------------------------------------------------------------*/
  1766.     /* Code Body                                                      */
  1767.     /*----------------------------------------------------------------*/
  1768.     close_sub_LCD_dt_display();
  1769.     SUBLCD_ExitCategoryFunction = MMI_dummy_function;
  1770. }
  1771. /*****************************************************************************
  1772.  * FUNCTION
  1773.  *  ShowSubLCDAnalogClockScreen
  1774.  * DESCRIPTION
  1775.  *  
  1776.  * PARAMETERS
  1777.  *  void
  1778.  * RETURNS
  1779.  *  void
  1780.  *****************************************************************************/
  1781. void ShowSubLCDAnalogClockScreen(void)
  1782. {
  1783.     /*----------------------------------------------------------------*/
  1784.     /* Local Variables                                                */
  1785.     /*----------------------------------------------------------------*/
  1786.     /*----------------------------------------------------------------*/
  1787.     /* Code Body                                                      */
  1788.     /*----------------------------------------------------------------*/
  1789.     GDI_LOCK;
  1790.     SUBLCD_ExitCategoryFunction();
  1791.     hide_status_icon_bar(2);
  1792.     analog_clock_initialize();
  1793.     set_dt_display(DT_SUBLCD_ANALOG_CLOCK);
  1794.     RedrawSubLCDAnalogClockScreen();
  1795.     SUBLCD_ExitCategoryFunction = ExitSubLCDAnalogClockScreen;
  1796.     SUBLCD_RedrawCategoryFunction = ExitSubLCDAnalogClockScreen;
  1797.     GDI_UNLOCK;
  1798. }
  1799. /*****************************************************************************
  1800.  * FUNCTION
  1801.  *  ExitCategory310Screen
  1802.  * DESCRIPTION
  1803.  *  
  1804.  * PARAMETERS
  1805.  *  void
  1806.  * RETURNS
  1807.  *  void
  1808.  *****************************************************************************/
  1809. void ExitCategory310Screen(void)
  1810. {
  1811.     /*----------------------------------------------------------------*/
  1812.     /* Local Variables                                                */
  1813.     /*----------------------------------------------------------------*/
  1814.     /*----------------------------------------------------------------*/
  1815.     /* Code Body                                                      */
  1816.     /*----------------------------------------------------------------*/
  1817.     g_mmi_gui_in_cat310 = MMI_FALSE;
  1818. }
  1819. /******************************************************************
  1820. Function Name  :  ShowCategory310Screen ( (UI_string_type) string )
  1821. Memo        :  Show single string in sublcd ( center alignment vertically and horizontaly )
  1822. ******************************************************************/
  1823. /*****************************************************************************
  1824.  * FUNCTION
  1825.  *  ShowCategory310Screen
  1826.  * DESCRIPTION
  1827.  *  
  1828.  * PARAMETERS
  1829.  *  string      [IN]        
  1830.  * RETURNS
  1831.  *  void
  1832.  *****************************************************************************/
  1833. void ShowCategory310Screen(UI_string_type string)
  1834. {
  1835. #ifdef __MMI_SUBLCD__
  1836.     /*----------------------------------------------------------------*/
  1837.     /* Local Variables                                                */
  1838.     /*----------------------------------------------------------------*/
  1839.     dm_data_struct dm_data;
  1840.     /*----------------------------------------------------------------*/
  1841.     /* Code Body                                                      */
  1842.     /*----------------------------------------------------------------*/
  1843.     if (g_mmi_gui_in_cat310 == MMI_TRUE)
  1844.     {
  1845.         return;
  1846.     }
  1847.     else
  1848.     {
  1849.         g_mmi_gui_in_cat310 = MMI_TRUE;
  1850.     }
  1851.     GDI_LOCK;
  1852.     SUBLCD_ExitCategoryFunction();
  1853.     hide_status_icon_bar(2);
  1854.     dm_add_string(string, &MMI_medium_font, UI_COLOR_BLACK, UI_COLOR_WHITE, NULL);
  1855.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  1856.     dm_data.s32CatId = MMI_CATEGORY310_ID;
  1857.     dm_data.s32flags = DM_SUB_LCD_CONTEXT;
  1858.     dm_data.s32flags = DM_SUB_LCD_ROTATE_180;
  1859.     dm_sublcd_setup_data(&dm_data);
  1860.     SUBLCD_ExitCategoryFunction = ExitCategory310Screen;
  1861.     SUBLCD_RedrawCategoryFunction = MMI_dummy_function;
  1862.     SUBLCD_GetCategoryHistory = dummy_get_history;
  1863.     SUBLCD_GetCategoryHistorySize = dummy_get_history_size;
  1864.     dm_sublcd_redraw_category_screen();
  1865.     GDI_UNLOCK;
  1866. #endif /* __MMI_SUBLCD__ */ 
  1867. }
  1868. /*****************************************************************************
  1869.  * FUNCTION
  1870.  *  ShowSubLCDLogoString
  1871.  * DESCRIPTION
  1872.  *  
  1873.  * PARAMETERS
  1874.  *  void
  1875.  * RETURNS
  1876.  *  void
  1877.  *****************************************************************************/
  1878. void ShowSubLCDLogoString(void)
  1879. {
  1880.     /*----------------------------------------------------------------*/
  1881.     /* Local Variables                                                */
  1882.     /*----------------------------------------------------------------*/
  1883.     /*----------------------------------------------------------------*/
  1884.     /* Code Body                                                      */
  1885.     /*----------------------------------------------------------------*/
  1886.     ShowCategory310Screen(get_string(STR_GLOBAL_LOGO));
  1887. }
  1888. /*****************************************************************************
  1889.  * FUNCTION
  1890.  *  DrawCate314CategoryControlArea
  1891.  * DESCRIPTION
  1892.  *  
  1893.  * PARAMETERS
  1894.  *  coordinate      [?]     
  1895.  * RETURNS
  1896.  *  void
  1897.  *****************************************************************************/
  1898. void DrawCate314CategoryControlArea(dm_coordinates *coordinate)
  1899. {
  1900.     /*----------------------------------------------------------------*/
  1901.     /* Local Variables                                                */
  1902.     /*----------------------------------------------------------------*/
  1903.     /*----------------------------------------------------------------*/
  1904.     /* Code Body                                                      */
  1905.     /*----------------------------------------------------------------*/
  1906. #ifdef __MMI_SUB_WALLPAPER__
  1907.     SUBLCD_UpdateWallpaper();//052406 Calvin
  1908. #endif
  1909. }
  1910. /*****************************************************************************
  1911.  * FUNCTION
  1912.  *  ExitCategory314Screen
  1913.  * DESCRIPTION
  1914.  *  
  1915.  * PARAMETERS
  1916.  *  void
  1917.  * RETURNS
  1918.  *  void
  1919.  *****************************************************************************/
  1920. void ExitCategory314Screen(void)
  1921. {
  1922.     /*----------------------------------------------------------------*/
  1923.     /* Local Variables                                                */
  1924.     /*----------------------------------------------------------------*/
  1925.     /*----------------------------------------------------------------*/
  1926.     /* Code Body                                                      */
  1927.     /*----------------------------------------------------------------*/
  1928.     MMI_fixed_list_menu.flags &= ~UI_LIST_MENU_DISABLE_BKGRND_IN_LAYER;
  1929.     MMI_fixed_list_menu.act_layer_handle = GDI_LAYER_MAIN_BASE_LAYER_HANDLE;
  1930.     MMI_fixed_list_menu.act_lcd_handle = GDI_LCD_MAIN_LCD_HANDLE;
  1931.     reset_fixed_list();
  1932.     wgui_reset_wallpaper_on_bottom();
  1933. }
  1934. /*****************************************************************************
  1935.  * FUNCTION
  1936.  *  UpdateCategory314KeyStateInd
  1937.  * DESCRIPTION
  1938.  *  
  1939.  * PARAMETERS
  1940.  *  state       [IN]        
  1941.  * RETURNS
  1942.  *  void
  1943.  *****************************************************************************/
  1944. void UpdateCategory314KeyStateInd(MMI_BOOL state)
  1945. {
  1946.     /*----------------------------------------------------------------*/
  1947.     /* Local Variables                                                */
  1948.     /*----------------------------------------------------------------*/
  1949.     /*----------------------------------------------------------------*/
  1950.     /* Code Body                                                      */
  1951.     /*----------------------------------------------------------------*/
  1952.     gdi_lcd_set_active(GDI_LCD_SUB_LCD_HANDLE);
  1953.     gdi_layer_push_and_set_active(MMI_fixed_list_menu.act_layer_handle);
  1954.     if (state)
  1955.     {
  1956.         MMI_title_icon = (PU8) get_image(IMG_GLOBAL_L30);
  1957.     }
  1958.     else
  1959.     {
  1960.         MMI_title_icon = NULL;
  1961.     }
  1962.     draw_title();
  1963.     gdi_layer_pop_and_restore_active();
  1964.     gdi_lcd_set_active(GDI_LCD_MAIN_LCD_HANDLE);
  1965. }
  1966. /*****************************************************************************
  1967.  * FUNCTION
  1968.  *  ShowCategory314Screen
  1969.  * DESCRIPTION
  1970.  *  
  1971.  * PARAMETERS
  1972.  *  title                       [?]         
  1973.  *  title_icon                  [IN]        
  1974.  *  number_of_items             [IN]        
  1975.  *  list_of_items               [IN]        
  1976.  *  list_of_icons               [?]         
  1977.  *  list_of_descriptions        [IN]        
  1978.  *  highlighted_item            [IN]        
  1979.  *  history_buffer              [?]         
  1980.  * RETURNS
  1981.  *  void
  1982.  *****************************************************************************/
  1983. void ShowCategory314Screen(
  1984.         U8 *title,
  1985.         U16 title_icon,
  1986.         S32 number_of_items,
  1987.         U16 *list_of_items,
  1988.         U16 *list_of_icons,
  1989.         U8 **list_of_descriptions,
  1990.         S32 highlighted_item,
  1991.         U8 *history_buffer)
  1992. {
  1993.     /*----------------------------------------------------------------*/
  1994.     /* Local Variables                                                */
  1995.     /*----------------------------------------------------------------*/
  1996.     dm_data_struct dm_data;
  1997.     S32 i;
  1998.     U8 h_flag;
  1999.     /*----------------------------------------------------------------*/
  2000.     /* Code Body                                                      */
  2001.     /*----------------------------------------------------------------*/
  2002.     SUBLCD_ExitCategoryFunction();
  2003.     UI_set_sub_LCD_graphics_context();
  2004.     gdi_layer_lock_frame_buffer();
  2005.     create_fixed_icontext_menuitems();
  2006.     associate_fixed_icontext_list();
  2007.     /* Title */
  2008.     MMI_title_string = (UI_string_type) title;
  2009.     MMI_title_icon = (PU8) get_image(title_icon);
  2010.     MMI_disable_title_shortcut_display = 1;
  2011.     disable_menu_shortcut_box_display = 1;
  2012.     MMI_menu_shortcut_number = -1;
  2013.     hide_status_icon_bar(2);
  2014.     /* List */
  2015.     MMI_current_menu_type = LIST_MENU;
  2016.     //              register_fixed_list_keys();
  2017.     //              resize_fixed_icontext_menuitems(0,MMI_MENUITEM_HEIGHT);
  2018.     resize_fixed_list(
  2019.         UI_device_width, UI_device_height - MMI_SUBLCD_TITLE_HEIGHT);
  2020.     resize_fixed_icontext_menuitems(
  2021.         MMI_fixed_list_menu.width - MMI_fixed_list_menu.vbar.width - 1,
  2022.         MMI_fixed_icontext_menuitem.height);
  2023.     register_fixed_list_highlight_handler(standard_list_highlight_handler);
  2024.     set_fixed_icontext_positions(MMI_MENUITEM_HEIGHT + 2, 0, 1, 0);
  2025.     register_fixed_list_keys();
  2026.     MMI_fixed_list_menu.flags |= UI_LIST_MENU_DISABLE_BKGRND_IN_LAYER;
  2027.     MMI_fixed_list_menu.act_layer_handle = GDI_LAYER_SUB_BASE_LAYER_HANDLE;
  2028.     MMI_fixed_list_menu.act_lcd_handle = GDI_LCD_SUB_LCD_HANDLE;
  2029.     wgui_set_wallpaper_on_bottom(TRUE);
  2030.     if (list_of_descriptions == NULL)
  2031.     {
  2032.         for (i = 0; i < number_of_items; i++)
  2033.         {
  2034.             add_fixed_icontext_item((UI_string_type) get_string(list_of_items[i]), wgui_get_list_menu_icon(i, list_of_icons[i]));
  2035.             wgui_pop_up_description_strings[i].text_strings[0] = NULL;
  2036.         }
  2037.     }
  2038.     else
  2039.     {
  2040.         for (i = 0; i < number_of_items; i++)
  2041.         {
  2042.             add_fixed_icontext_item((UI_string_type) get_string(list_of_items[i]), wgui_get_list_menu_icon(i, list_of_icons[i]));
  2043.             wgui_pop_up_description_strings[i].text_strings[0] = (UI_string_type) list_of_descriptions[i];
  2044.         }
  2045.     }
  2046.     h_flag = set_list_menu_category_history(MMI_CATEGORY314_ID, history_buffer);
  2047. #ifdef __MMI_UI_HINTS_IN_MENUITEM__
  2048.     if (list_of_descriptions != NULL)
  2049.     {
  2050.         S32 hints = 0;
  2051.         for (i = 0; i < number_of_items; i++)
  2052.         {
  2053.             if (wgui_pop_up_description_strings[i].text_strings[0])
  2054.             {
  2055.                 hints = 1;
  2056.                 break;
  2057.             }
  2058.         }
  2059.         if (hints)
  2060.         {
  2061.             if (is_set_force_icon_on_highlight_only_in_menuitem())
  2062.             {
  2063.                 wgui_show_icon_only_highlight_in_icontext_menuitem();
  2064.             }
  2065.             if (is_set_force_all_hints_in_menuitem())
  2066.             {
  2067.                 wgui_enable_hints_in_icontext_menuitem();
  2068.             }
  2069.             else if (is_set_force_hints_on_highlight_in_menuitem())
  2070.             {
  2071.                 wgui_enable_hint_highlight_in_icontext_menuitem();
  2072.             }
  2073.             else
  2074.             {
  2075.                 wgui_enable_hint_highlight_in_icontext_menuitem();
  2076.             }
  2077.             set_pop_up_descriptions(1, number_of_items, MMI_fixed_list_menu.highlighted_item);
  2078.         #ifdef __MMI_UI_LIST_HIGHLIGHT_EFFECTS__
  2079.             gui_block_list_effect();
  2080.         #endif 
  2081.         }
  2082.     }
  2083. #endif /* __MMI_UI_HINTS_IN_MENUITEM__ */ 
  2084.     if (h_flag)
  2085.     {
  2086.         fixed_list_goto_item_no_redraw(MMI_fixed_list_menu.highlighted_item);
  2087.     }
  2088.     else
  2089.     {
  2090.         fixed_list_goto_item_no_redraw(highlighted_item);
  2091.     }
  2092.     MMI_title_string = (UI_string_type) title;
  2093.     MMI_title_icon = (PU8) get_image(title_icon);
  2094.     set_pop_up_descriptions(1, number_of_items, MMI_fixed_list_menu.highlighted_item);
  2095.     gdi_layer_unlock_frame_buffer();
  2096.     ExitCategoryFunction = ExitCategory314Screen;
  2097.     dm_setup_category_functions(dm_redraw_category_screen, dm_get_category_history, dm_get_category_history_size);
  2098.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  2099.     dm_data.s32CatId = MMI_CATEGORY314_ID;
  2100.     dm_data.s32flags = DM_SUB_LCD_CONTEXT;
  2101.     dm_sublcd_setup_data(&dm_data);
  2102.     dm_sublcd_redraw_category_screen();
  2103.     UI_set_main_LCD_graphics_context();
  2104. }
  2105. #endif /* __MMI_SUBLCD__ */