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

MTK

开发平台:

C/C++

  1.     /*----------------------------------------------------------------*/
  2.     /* Code Body                                                      */
  3.     /*----------------------------------------------------------------*/
  4.     //      color c=gui_color(255,255,255);
  5.     //PMT DLT_FIXES - TK 200603225 END
  6.     gdi_layer_reset_clip();
  7.     gui_fill_rectangle(x1, y1, x2, y2, c);
  8. }
  9. #ifdef __MMI_UI_TECHNO_IDLESCREEN_BAR__
  10. extern S32 MAIN_LCD_device_width;
  11. #endif 
  12. #define DT_DISPLAY_GAP  1
  13. U8 enable_main_LCD_date_time_display = 1;
  14. U8 enable_sub_LCD_date_time_display = 1;
  15. //KP Jerry add on 2007-3-27 start
  16. #ifdef __MMI_IDLE_SHOW_TIME_WITH_IMAGE__
  17. S32 get_image_from_numberID(U8 number)
  18. {
  19.     S32 imageID;
  20.     switch (number)
  21.     {
  22.      case 0:
  23. imageID = IMG_TECHNO_DIGITAL_CLOCK_TIME_0;
  24. break;
  25.      case 1:
  26. imageID = IMG_TECHNO_DIGITAL_CLOCK_TIME_1;
  27. break;
  28.      case 2:
  29. imageID = IMG_TECHNO_DIGITAL_CLOCK_TIME_2;
  30. break;
  31.      case 3:
  32. imageID = IMG_TECHNO_DIGITAL_CLOCK_TIME_3;
  33. break;
  34.      case 4:
  35. imageID = IMG_TECHNO_DIGITAL_CLOCK_TIME_4;
  36. break;
  37.      case 5:
  38. imageID = IMG_TECHNO_DIGITAL_CLOCK_TIME_5;
  39. break;
  40.      case 6:
  41. imageID = IMG_TECHNO_DIGITAL_CLOCK_TIME_6;
  42. break;
  43.      case 7:
  44. imageID = IMG_TECHNO_DIGITAL_CLOCK_TIME_7;
  45. break;
  46.      case 8:
  47. imageID = IMG_TECHNO_DIGITAL_CLOCK_TIME_8;
  48. break;
  49.      case 9:
  50. imageID = IMG_TECHNO_DIGITAL_CLOCK_TIME_9;
  51. break;
  52. default:
  53. break;
  54.     }
  55.     return imageID;
  56. }
  57. void show_main_LCD_idle_time_with_image(UI_time *t)
  58. {
  59.     /*----------------------------------------------------------------*/
  60.     /* Local Variables                                                */
  61.     /*----------------------------------------------------------------*/
  62.     U16 hours, minutes;
  63.     S32 h, w, x, y;
  64.     S32 show_imageID;
  65.     U8   numberID;
  66.     gui_measure_image(get_image(IMG_TECHNO_DIGITAL_CLOCK_TIME_0), &w, &h);
  67.     gui_push_clip();
  68.     
  69.     x = MMI_SIGNAL_WIDTH;   
  70.     y = MMI_status_bar_height + (MMI_IDLESCREEN_BAR_HEIGHT >> 1) - (h >> 1);
  71.     gui_set_clip(x,y,x+w*6+18,y+h+5);
  72.    wgui_hide_background_with_wallpaper(x, y, x+w*6+18, y+h+5);
  73.     hours = get_hours(t);
  74.     if (!PhnsetGetTimeFormat())  /* get current time format */
  75.     {
  76.        if(hours==0) 
  77.           hours = 12;
  78.        if(hours>12) 
  79.           hours -= 12;
  80.     }
  81.     //显示小时的 十位数
  82.     numberID = hours/10;
  83.     show_imageID = get_image_from_numberID(numberID);
  84.     gui_show_image(x,y , get_image(show_imageID));
  85.     //显示小时的个位数
  86.     numberID = hours%10;
  87.     show_imageID = get_image_from_numberID(numberID);
  88.     gui_show_image(x+w+2,y , get_image(show_imageID));
  89.     //显示冒号
  90.     gui_show_image(x+w*2+5,y , get_image(IMG_TECHNO_DIGITAL_CLOCK_TIME_FLAG));
  91.     minutes = get_minutes(t);
  92.     //显示分钟的十位数
  93.     numberID = minutes/10;
  94.     show_imageID = get_image_from_numberID(numberID);
  95.     gui_show_image(x+w*3+2,y , get_image(show_imageID));
  96.     
  97.     //显示分钟的个位数
  98.     numberID = minutes%10;
  99.     show_imageID = get_image_from_numberID(numberID);
  100.     gui_show_image(x+w*4+2,y , get_image(show_imageID));
  101.     //当时间格式为12小时制时 显示AM 或PM
  102.     if (!PhnsetGetTimeFormat())  /* get current time format */
  103.     {
  104.        hours = get_hours(t);
  105.      if (hours == 12)
  106.        {
  107.          gui_show_image(x+w*5+4,y+h/2, get_image(IMG_TECHNO_DIGITAL_CLOCK_TIME_PM));
  108.        }
  109.        else if (hours == 0)
  110.        {
  111.               gui_show_image(x+w*5+2,y , get_image(IMG_TECHNO_DIGITAL_CLOCK_TIME_AM));
  112.        }
  113.        else if (hours > 12)
  114.        {
  115.              gui_show_image(x+w*5+4,y+h/2 , get_image(IMG_TECHNO_DIGITAL_CLOCK_TIME_PM));
  116.        }
  117.        else
  118.        {
  119.              gui_show_image(x+w*5+2,y, get_image(IMG_TECHNO_DIGITAL_CLOCK_TIME_AM));
  120.        }
  121.     }
  122.      
  123.     gui_pop_clip();
  124.     
  125. }
  126. #endif/*__MMI_IDLE_SHOW_TIME_WITH_IMAGE__*/
  127. //KP Jerry add on 2007-3-27 end
  128. /*****************************************************************************
  129.  * FUNCTION
  130.  *  show_main_LCD_date_time
  131.  * DESCRIPTION
  132.  *  show upadte date time on main lcd /sub lcd depend on the
  133.  *  current date flag
  134.  * PARAMETERS
  135.  *  void
  136.  * RETURNS
  137.  *  void
  138.  *****************************************************************************/
  139. void show_main_LCD_date_time(void)
  140. {
  141.     /*----------------------------------------------------------------*/
  142.     /* Local Variables                                                */
  143.     /*----------------------------------------------------------------*/
  144.     S32 h, w, x, y;
  145.     UI_character_type s[64];
  146.     S32 x1, y1, x2, y2;
  147.     bitmap *saved_graphics_context = current_LCD_device_bitmap;
  148.     S32 old_x1, old_y1, old_x2, old_y2;
  149.     /*----------------------------------------------------------------*/
  150.     /* Code Body                                                      */
  151.     /*----------------------------------------------------------------*/
  152.     if (main_lcd_update_date_time == MMI_FALSE)
  153.     {
  154.         return;
  155.     }
  156.     UI_set_main_LCD_graphics_context();
  157.     old_x1 =
  158.         (main_LCD_dt_object.time.x < main_LCD_dt_object.date.x) ? main_LCD_dt_object.time.x : main_LCD_dt_object.date.x;
  159.     old_y1 =
  160.         (main_LCD_dt_object.time.y < main_LCD_dt_object.date.y) ? main_LCD_dt_object.time.y : main_LCD_dt_object.date.y;
  161.     old_x2 =
  162.         (main_LCD_dt_object.time.x + main_LCD_dt_object.time.width >
  163.          main_LCD_dt_object.date.x + main_LCD_dt_object.date.width) ? main_LCD_dt_object.time.x +
  164.         main_LCD_dt_object.time.width : main_LCD_dt_object.date.x + main_LCD_dt_object.date.width;
  165.     old_y2 =
  166.         (main_LCD_dt_object.time.y + main_LCD_dt_object.time.height >
  167.          main_LCD_dt_object.date.y + main_LCD_dt_object.date.height) ? main_LCD_dt_object.time.y +
  168.         main_LCD_dt_object.time.height : main_LCD_dt_object.date.y + main_LCD_dt_object.date.height;
  169.     gdi_layer_push_clip();
  170.     gdi_layer_reset_clip();
  171. #ifdef __MMI_UI_TECHNO_IDLESCREEN_BAR__    //jerson add 20070605
  172. //KP Jerry add for recovery time display when exiting from stop-watch on 2007-1-8 start
  173. if(g_clock_type>1)
  174. {
  175. PhnsetReadIdleClockType();
  176. }
  177. //KP Jerry add for recovery time display when exiting from stop-watch  on 2007-1-8 end
  178.  #endif
  179.     switch (main_LCD_dt_object.flags & DT_FLAGS_TYPE)
  180.     {
  181.         case DT_IDLE_SCREEN:
  182.         {
  183.         #ifdef __MMI_UI_TECHNO_IDLESCREEN_BAR__
  184.             switch (g_clock_type)
  185.             {
  186.                 case ANALOG:
  187.                     if (enable_main_LCD_date_time_display)
  188.                     {
  189.                         show_analog_clock();
  190.                     }
  191.                     break;
  192.                 case DIGITAL:
  193.         #endif /* __MMI_UI_TECHNO_IDLESCREEN_BAR__ */ 
  194. //KP Jerry modify on 2007-3-27 start
  195. #if defined(__MMI_IDLE_SHOW_TIME_WITH_IMAGE__)
  196.       show_main_LCD_idle_time_with_image(&main_LCD_dt_object.time.t);
  197. #else
  198.                     gui_set_font(main_LCD_dt_object.time.font);
  199.                     /* get current time in string format */
  200.                     time_string(&main_LCD_dt_object.time.t, (UI_string_type) s, main_LCD_dt_object.flags);
  201.                     /* calculate string width of time string */
  202.                     gui_measure_string(s, &w, &h);
  203.                 #ifdef __MMI_UI_TECHNO_IDLESCREEN_BAR__
  204.                     x = MMI_SIGNAL_WIDTH;     //Old:x = ANALOG_BACKGROUND_X + (ANALOG_BACKGROUND_WIDTH >> 1) - (w >> 1);    //KP Jerry modify for use dialing-font on 2006-11-30
  205.                     y = MMI_status_bar_height + (MMI_IDLESCREEN_BAR_HEIGHT >> 1) - (h >> 1)-20;
  206.                 #elif defined(__MMI_TOUCH_IDLESCREEN_SHORTCUTS__)
  207.                     /* change in value of y, when the __MMI_UI_TECHNO_IDLESCREEN_BAR__
  208.                        is not enabled and idlescreen shortcuts are enabled. */
  209.                     x = (UI_device_width >> 1) - (w >> 1);
  210.                     y = UI_device_height - max_touch_idle_screen_shortcut_height() - (h + (DT_DISPLAY_GAP << 1)) - 4;
  211.                 #elif defined(__MMI_UI_DALMATIAN_SOFTKEYS__)
  212.                     x = (UI_device_width >> 1) - (w >> 1);
  213.                     y = UI_device_height - MMI_button_bar_height - (h + (DT_DISPLAY_GAP << 1)) - 4;
  214.                 #else 
  215.                     /* calculate start x ,y and end x,y position of time display string */
  216.                     x = (UI_device_width >> 1) - (w >> 1);
  217.                     y = UI_device_height - MMI_softkey_height - (h + (DT_DISPLAY_GAP << 1)) - 4;
  218.                 #endif 
  219.                     x1 = main_LCD_dt_object.time.x = x;
  220.                     y1 = main_LCD_dt_object.time.y = y;
  221.                     main_LCD_dt_object.time.width = w + (DT_DISPLAY_GAP << 1);
  222.                     main_LCD_dt_object.time.height = h + (DT_DISPLAY_GAP << 1);
  223.                     if (enable_main_LCD_date_time_display)
  224.                     {
  225.                         gui_set_text_color(main_LCD_dt_object.time.text_color);
  226.                         gui_set_text_border_color(main_LCD_dt_object.time.text_border_color);
  227.                         if (r2lMMIFlag)
  228.                         {
  229.                             gui_move_text_cursor(x + main_LCD_dt_object.time.width - 1, y + 1);
  230.                         }
  231.                         else
  232.                         {
  233.                             gui_move_text_cursor(x, y + 1);
  234.                         }
  235.                         x2 = x1 + main_LCD_dt_object.time.width - 1;
  236.                         y2 = y1 + main_LCD_dt_object.time.height - 1;
  237.                     #ifdef __MMI_UI_TECHNO_IDLESCREEN_BAR__
  238.                         gui_push_clip();//070306 Alpha layer
  239.                         gui_set_clip(
  240.                             ANALOG_BACKGROUND_X,
  241.                             ANALOG_BACKGROUND_Y,
  242.                             ANALOG_BACKGROUND_X + ANALOG_BACKGROUND_WIDTH - 1,
  243.                             ANALOG_BACKGROUND_Y + MMI_IDLESCREEN_BAR_HEIGHT - 1);
  244.                         //gui_show_image(ANALOG_BACKGROUND_X, ANALOG_BACKGROUND_Y, get_image(IMG_TECHNO_DIGITAL_CLOCK));
  245.                         gui_show_image(ANALOG_BACKGROUND_X, ANALOG_BACKGROUND_Y, get_image(IMG_TECHNO_DIGITAL_CLOCK));     //Old:gui_show_image(0, ANALOG_BACKGROUND_Y, get_image(IMG_TECHNO_DIGITAL_CLOCK));     //KP Jerry modify on 2007-3-8
  246.                         gui_pop_clip();
  247.                     #endif 
  248.                     #ifdef __MMI_UI_DALMATIAN_IDLESCREEN__
  249.                         gui_set_text_clip(x1 - 1, y1, x2, y2);
  250.                     #else 
  251.                         gui_set_text_clip(x1, y1, x2, y2);
  252.                     #endif 
  253.                         gui_print_bordered_text(s);
  254.                         if (x1 < old_x1)
  255.                         {
  256.                             old_x1 = x1;
  257.                         }
  258.                         if (y1 < old_y1)
  259.                         {
  260.                             old_y1 = y1;
  261.                         }
  262.                         if (x2 > old_x2)
  263.                         {
  264.                             old_x2 = x2;
  265.                         }
  266.                         if (y2 > old_y2)
  267.                         {
  268.                             old_y2 = y2;
  269.                         }
  270.                     }
  271. #endif/*__MMI_IDLE_SHOW_TIME_WITH_IMAGE__*/
  272. //KP Jerry modify on 2007-3-27 end
  273.                 #ifdef __MMI_UI_TECHNO_IDLESCREEN_BAR__
  274.                     break;
  275.             }
  276.     show_main_LCD_day_display();//此函数显示星期几
  277.                 #endif                  /* __MMI_UI_TECHNO_IDLESCREEN_BAR__ */ 
  278.             gui_set_font(main_LCD_dt_object.date.font);
  279.             /* get current date in string format */
  280.             date_string(&main_LCD_dt_object.date.t, (UI_string_type) s, main_LCD_dt_object.flags);
  281.             /* calculate date string width */
  282.             gui_measure_string(s, &w, &h);
  283.             /* calculate start x,y and end x,y position of date string display */
  284.         #ifdef __MMI_UI_TECHNO_IDLESCREEN_BAR__
  285.             x = ((MAIN_LCD_device_width - MMI_SIGNAL_WIDTH - 2) - w);
  286.             y = MMI_status_bar_height + (MMI_IDLESCREEN_BAR_HEIGHT >> 2) - (h >> 1);
  287.         #else /* __MMI_UI_TECHNO_IDLESCREEN_BAR__ */ 
  288.             x = (UI_device_width >> 1) - (w >> 1);
  289.             y = y - main_LCD_dt_object.time.height;
  290.         #endif /* __MMI_UI_TECHNO_IDLESCREEN_BAR__ */ 
  291.         
  292.         #ifdef __N95__
  293. x-=45;
  294. y+=8;
  295.         #endif
  296.             x1 = main_LCD_dt_object.date.x = x;
  297.             y1 = main_LCD_dt_object.date.y = y;
  298.             main_LCD_dt_object.date.width = w + (DT_DISPLAY_GAP << 1);
  299.             main_LCD_dt_object.date.height = h + (DT_DISPLAY_GAP << 1);
  300.         if (enable_main_LCD_date_time_display)
  301.             {
  302.                 gui_set_text_color(main_LCD_dt_object.date.text_color);
  303.                 gui_set_text_border_color(main_LCD_dt_object.date.text_border_color);
  304.             #ifdef __MMI_UI_DALMATIAN_IDLESCREEN__
  305.                 /* To avoid passing y+1 to the curser move function */
  306.                 if (r2lMMIFlag)
  307.                 {
  308.                     gui_move_text_cursor(x + main_LCD_dt_object.date.width - 1, y);
  309.                 }
  310.                 else
  311.                 {
  312.                     gui_move_text_cursor(x, y);
  313.                 }
  314.             #else /* __MMI_UI_DALMATIAN_IDLESCREEN__ */ 
  315.                 if (r2lMMIFlag)
  316.                 {
  317.                     gui_move_text_cursor(x + main_LCD_dt_object.date.width - 1, y + 1);
  318.                 }
  319.                 else
  320.                 {
  321.                     gui_move_text_cursor(x, y + 1);
  322.                 }
  323.             #endif /* __MMI_UI_DALMATIAN_IDLESCREEN__ */ 
  324.                 x2 = x1 + main_LCD_dt_object.date.width - 1;
  325.                 y2 = y1 + main_LCD_dt_object.date.height - 1;
  326.             #ifdef __MMI_UI_DALMATIAN_IDLESCREEN__
  327.                 gui_set_clip(x1 - 1, y1 - 1, x2, y2);
  328.             #else 
  329.                 gui_set_clip(x1 - 1, y1 - 1, x2 + 1, y2 + 1);
  330.             #endif 
  331.             #ifdef __MMI_UI_TECHNO_IDLESCREEN_BAR__
  332. gui_print_bordered_text(s);    //Old:gui_print_text(s);     //KP Jerry modify for full-transparent TECHNO_IDLESCREEN_BAR background on 2006-11-15
  333.             #else 
  334.                 gui_print_bordered_text(s);
  335.             #endif 
  336.             #ifdef __MMI_UI_TECHNO_IDLESCREEN_BAR__
  337.                #ifndef __N95__
  338.                 gdi_layer_blt_previous(ANALOG_BACKGROUND_X,ANALOG_BACKGROUND_Y,UI_device_width - MMI_SIGNAL_WIDTH - 1,
  339.                                         MMI_status_bar_height + MMI_IDLESCREEN_BAR_HEIGHT - 1);
  340.                #endif
  341.                   /* 020305 Calvin modified */
  342.             #else /* __MMI_UI_TECHNO_IDLESCREEN_BAR__ */ 
  343.                 gdi_layer_blt_previous(x1 < old_x1 ? x1 : old_x1, y1 < old_y1 ? y1 : old_y1, x2 > old_x2 ? x2 : old_x2, y2 > old_y2 ? y2 : old_y2);     /* 020305 Calvin modified */
  344.             #endif /* __MMI_UI_TECHNO_IDLESCREEN_BAR__ */ 
  345.             }
  346.             if (enable_main_LCD_date_time_display)
  347.             {
  348.                 dm_coordinates coordinates;
  349.                 coordinates.s16X = main_LCD_dt_object.time.x;
  350.                 coordinates.s16Y = main_LCD_dt_object.time.y;
  351.                 coordinates.s16Width = main_LCD_dt_object.time.width;
  352.                 coordinates.s16Height = main_LCD_dt_object.time.height;
  353.                 setup_previous_control(&coordinates);
  354.             }
  355.         }
  356.             break;
  357.         case DT_IDLE_SCREEN_2:
  358.         {
  359. #define DT_SOFTKEY_GAP  2
  360.             gui_set_font(main_LCD_dt_object.time.font);
  361.             /* get current time in string format */
  362.             time_string(&main_LCD_dt_object.time.t, (UI_string_type) s, main_LCD_dt_object.flags);
  363.             /* calculate string width of time string */
  364.             gui_measure_string(s, &w, &h);
  365.             /* calculate start x ,y and end x,y position of time display string */
  366.             x = DT_SOFTKEY_GAP;
  367.         #ifdef __MMI_UI_STATUS_BAR_AT_BOTTOM__
  368.             y = DT_DISPLAY_OFFSET_IN_STATUS_BAR_AT_BOTTOM;
  369.         #else 
  370.             y = UI_device_height - MMI_button_bar_height - h - DT_SOFTKEY_GAP - 1;
  371.         #endif 
  372.             x1 = main_LCD_dt_object.time.x = x;
  373.             y1 = main_LCD_dt_object.time.y = y;
  374.             main_LCD_dt_object.time.width = w + (DT_DISPLAY_GAP << 1);
  375.             main_LCD_dt_object.time.height = h + (DT_DISPLAY_GAP << 1);
  376.             if (enable_main_LCD_date_time_display)
  377.             {
  378.                 gui_set_text_color(main_LCD_dt_object.time.text_color);
  379.                 gui_set_text_border_color(main_LCD_dt_object.time.text_border_color);
  380.                 if (r2lMMIFlag)
  381.                 {
  382.                     gui_move_text_cursor(x + main_LCD_dt_object.time.width - 1, y + 1);
  383.                 }
  384.                 else
  385.                 {
  386.                     gui_move_text_cursor(x, y + 1);
  387.                 }
  388.                 x2 = x1 + main_LCD_dt_object.time.width - 1;
  389.                 y2 = y1 + main_LCD_dt_object.time.height - 1;
  390.                 gui_print_bordered_text(s);
  391.                 if (x1 < old_x1)
  392.                 {
  393.                     old_x1 = x1;
  394.                 }
  395.                 if (y1 < old_y1)
  396.                 {
  397.                     old_y1 = y1;
  398.                 }
  399.                 if (x2 > old_x2)
  400.                 {
  401.                     old_x2 = x2;
  402.                 }
  403.                 if (y2 > old_y2)
  404.                 {
  405.                     old_y2 = y2;
  406.                 }
  407.             }
  408.             gui_set_font(main_LCD_dt_object.date.font);
  409.         #ifdef __MMI_UI_STATUS_BAR_AT_BOTTOM__
  410.             main_LCD_dt_object.flags &= ~DT_IDLE_SCREEN_2;
  411.             main_LCD_dt_object.flags |= DT_IDLE_SCREEN;
  412.         #endif /* __MMI_UI_STATUS_BAR_AT_BOTTOM__ */ 
  413.             /* get current date in string format */
  414.             date_string(&main_LCD_dt_object.date.t, (UI_string_type) s, main_LCD_dt_object.flags);
  415.         #ifdef __MMI_UI_STATUS_BAR_AT_BOTTOM__
  416.             main_LCD_dt_object.flags &= ~DT_IDLE_SCREEN;
  417.             main_LCD_dt_object.flags |= DT_IDLE_SCREEN_2;
  418.         #endif /* __MMI_UI_STATUS_BAR_AT_BOTTOM__ */ 
  419.             /* calculate date string width */
  420.             gui_measure_string(s, &w, &h);
  421.             /* calculate start x,y and end x,y position of date string display */
  422.             x = UI_device_width - 1 - w - DT_SOFTKEY_GAP;
  423.         #ifdef __MMI_UI_STATUS_BAR_AT_BOTTOM__
  424.             y = DT_DISPLAY_OFFSET_IN_STATUS_BAR_AT_BOTTOM;
  425.         #else 
  426.             y = UI_device_height - MMI_button_bar_height - h - DT_SOFTKEY_GAP - 1;
  427.         #endif 
  428.             x1 = main_LCD_dt_object.date.x = x;
  429.             y1 = main_LCD_dt_object.date.y = y;
  430.             main_LCD_dt_object.date.width = w + (DT_DISPLAY_GAP << 1);
  431.             main_LCD_dt_object.date.height = h + (DT_DISPLAY_GAP << 1);
  432.             if (enable_main_LCD_date_time_display)
  433.             {
  434.                 gui_set_text_color(main_LCD_dt_object.date.text_color);
  435.                 gui_set_text_border_color(main_LCD_dt_object.date.text_border_color);
  436.                 if (r2lMMIFlag)
  437.                 {
  438.                     gui_move_text_cursor(x + main_LCD_dt_object.date.width - 1, y + 1);
  439.                 }
  440.                 else
  441.                 {
  442.                     gui_move_text_cursor(x, y + 1);
  443.                 }
  444.                 x2 = x1 + main_LCD_dt_object.date.width - 1;
  445.                 y2 = y1 + main_LCD_dt_object.date.height - 1;
  446.                 gui_print_bordered_text(s);
  447.                 gdi_layer_blt_previous(x1 < old_x1 ? x1 : old_x1, y1 < old_y1 ? y1 : old_y1, x2 > old_x2 ? x2 : old_x2, y2 > old_y2 ? y2 : old_y2);     /* 020305 Calvin modified */
  448.             }
  449.         }
  450.             break;
  451.         case DT_NETWORK_SEARCH:
  452.         {
  453.             gui_set_font(main_LCD_dt_object.time.font);
  454.             /* get current time in string format */
  455.             time_string(&main_LCD_dt_object.time.t, (UI_string_type) s, main_LCD_dt_object.flags);
  456.             gui_measure_string(s, &w, &h);
  457.             x = (UI_device_width >> 1) - (w >> 1);
  458.         #if defined(__MMI_UI_DALMATIAN_SOFTKEYS__) || defined(__MMI_UI_DALMATIAN_IDLESCREEN__)
  459.             y = UI_device_height - MMI_button_bar_height - (h + (BAR_CONTENT_GAP));
  460.         #else 
  461.             y = UI_device_height - MMI_softkey_height - (h + (DT_DISPLAY_GAP << 1)) - 1;
  462.         #endif 
  463.             x1 = main_LCD_dt_object.time.x = x;
  464.             y1 = main_LCD_dt_object.time.y = y;
  465.             main_LCD_dt_object.time.width = w + (DT_DISPLAY_GAP << 1);
  466.             main_LCD_dt_object.time.height = h + (DT_DISPLAY_GAP << 1);
  467.             if (enable_main_LCD_date_time_display)
  468.             {
  469.                 gui_set_text_color(main_LCD_dt_object.time.text_color);
  470.                 gui_set_text_border_color(main_LCD_dt_object.time.text_border_color);
  471.             #ifdef __MMI_UI_DALMATIAN_IDLESCREEN__
  472.                 if (r2lMMIFlag)
  473.                 {
  474.                     gui_move_text_cursor(x + main_LCD_dt_object.time.width - 1, y);
  475.                 }
  476.                 else
  477.                 {
  478.                     gui_move_text_cursor(x, y);
  479.                 }
  480.             #else /* __MMI_UI_DALMATIAN_IDLESCREEN__ */ 
  481.                 if (r2lMMIFlag)
  482.                 {
  483.                     gui_move_text_cursor(x + main_LCD_dt_object.time.width - 1, y + 1);
  484.                 }
  485.                 else
  486.                 {
  487.                     gui_move_text_cursor(x, y + 1);
  488.                 }
  489.             #endif /* __MMI_UI_DALMATIAN_IDLESCREEN__ */ 
  490.                 x2 = x1 + main_LCD_dt_object.time.width - 1;
  491.                 y2 = y1 + main_LCD_dt_object.time.height - 1;
  492.             #ifdef __MMI_UI_DALMATIAN_IDLESCREEN__
  493.                 gui_set_text_clip(x1 - 1, y1, x2, y2);  /* For proper clipping of the text */
  494.             #else 
  495.                 gui_set_text_clip(x1, y1, x2, y2);
  496.             #endif 
  497.                 gui_print_bordered_text(s);
  498.                 if (x1 < old_x1)
  499.                 {
  500.                     old_x1 = x1;
  501.                 }
  502.                 if (y1 < old_y1)
  503.                 {
  504.                     old_y1 = y1;
  505.                 }
  506.                 if (x2 > old_x2)
  507.                 {
  508.                     old_x2 = x2;
  509.                 }
  510.                 if (y2 > old_y2)
  511.                 {
  512.                     old_y2 = y2;
  513.                 }
  514.             }
  515.             gui_set_font(main_LCD_dt_object.date.font);
  516.             /* get date in string format */
  517.             date_string(&main_LCD_dt_object.date.t, (UI_string_type) s, main_LCD_dt_object.flags);
  518.             gui_measure_string(s, &w, &h);
  519.             x = (UI_device_width >> 1) - (w >> 1);
  520.         #if defined(__MMI_UI_DALMATIAN_SOFTKEYS__) || defined(__MMI_UI_DALMATIAN_IDLESCREEN__) || defined(__MMI_MAINLCD_128X128__)//060606 network search Calvin
  521.             y = y - h - 1;  /* to handle the font height change on dalmatian */
  522.         #else 
  523.             y = y - main_LCD_dt_object.time.height;
  524.         #endif 
  525.             x1 = main_LCD_dt_object.date.x = x;
  526.             y1 = main_LCD_dt_object.date.y = y;
  527.             main_LCD_dt_object.date.width = w + (DT_DISPLAY_GAP << 1);
  528.             main_LCD_dt_object.date.height = h + (DT_DISPLAY_GAP << 1);
  529.             if (enable_main_LCD_date_time_display)
  530.             {
  531.                 gui_set_text_color(main_LCD_dt_object.date.text_color);
  532.                 gui_set_text_border_color(main_LCD_dt_object.date.text_border_color);
  533.             #ifdef __MMI_UI_DALMATIAN_IDLESCREEN__
  534.                 if (r2lMMIFlag)
  535.                 {
  536.                     gui_move_text_cursor(x + main_LCD_dt_object.date.width - 1, y);
  537.                 }
  538.                 else
  539.                 {
  540.                     gui_move_text_cursor(x, y);
  541.                 }
  542.             #else /* __MMI_UI_DALMATIAN_IDLESCREEN__ */ 
  543.                 if (r2lMMIFlag)
  544.                 {
  545.                     gui_move_text_cursor(x + main_LCD_dt_object.date.width - 1, y + 1);
  546.                 }
  547.                 else
  548.                 {
  549.                     gui_move_text_cursor(x, y + 1);
  550.                 }
  551.             #endif /* __MMI_UI_DALMATIAN_IDLESCREEN__ */ 
  552.                 x2 = x1 + main_LCD_dt_object.date.width - 1;
  553.                 y2 = y1 + main_LCD_dt_object.date.height - 1;
  554.             #ifdef __MMI_UI_DALMATIAN_IDLESCREEN__
  555.                 gui_set_text_clip(x1 - 1, y1, x2, y2);
  556.             #else 
  557.                 gui_set_text_clip(x1, y1, x2, y2);
  558.             #endif 
  559.                 gui_print_bordered_text(s);
  560.                 gdi_layer_blt_previous(
  561.                     x1 < old_x1 ? x1 : old_x1,
  562.                     y1 < old_y1 ? y1 : old_y1,
  563.                     x2 > old_x2 ? x2 : old_x2,
  564.                     y2 > old_y2 ? y2 : old_y2);
  565.             }
  566.             if (enable_main_LCD_date_time_display)
  567.             {
  568.                 dm_coordinates coordinates;
  569.                 coordinates.s16X = main_LCD_dt_object.time.x;
  570.                 coordinates.s16Y = main_LCD_dt_object.time.y;
  571.                 coordinates.s16Width = main_LCD_dt_object.time.width;
  572.                 coordinates.s16Height = main_LCD_dt_object.time.height;
  573.                 setup_previous_control(&coordinates);
  574.             }
  575.         }
  576.             break;
  577.         case DT_MO_CALL_SCREEN:
  578.         case DT_MO_CALLING_SCREEN:
  579.         {
  580.             y = MMI_status_bar_height;
  581.             gui_set_font(main_LCD_dt_object.date.font);
  582.             /* get current date in string format */
  583.             date_string(&main_LCD_dt_object.date.t, (UI_string_type) s, main_LCD_dt_object.flags);
  584.             gui_measure_string(s, &w, &h);
  585.             x = 2;
  586.             x1 = main_LCD_dt_object.date.x = x;
  587.             y1 = main_LCD_dt_object.date.y = y;
  588.             main_LCD_dt_object.date.width = w;
  589.             main_LCD_dt_object.date.height = h;
  590.             if (enable_main_LCD_date_time_display)
  591.             {
  592.                 gui_set_text_color(main_LCD_dt_object.date.text_color);
  593.                 if (r2lMMIFlag)
  594.                 {
  595.                     gui_move_text_cursor(x + main_LCD_dt_object.date.width - 1, y);
  596.                 }
  597.                 else
  598.                 {
  599.                     gui_move_text_cursor(x, y);
  600.                 }
  601.                 x2 = x1 + main_LCD_dt_object.date.width - 1;
  602.                 y2 = y1 + main_LCD_dt_object.date.height - 1;
  603.                 /* print current date */
  604.                 gui_print_text(s);
  605.                 if (x1 < old_x1)
  606.                 {
  607.                     old_x1 = x1;
  608.                 }
  609.                 if (y1 < old_y1)
  610.                 {
  611.                     old_y1 = y1;
  612.                 }
  613.                 if (x2 > old_x2)
  614.                 {
  615.                     old_x2 = x2;
  616.                 }
  617.                 if (y2 > old_y2)
  618.                 {
  619.                     old_y2 = y2;
  620.                 }
  621.             }
  622.             gui_set_font(main_LCD_dt_object.time.font);
  623.             x = 2;
  624.             y = y + h;
  625.             time_string(&main_LCD_dt_object.time.t, (UI_string_type) s, main_LCD_dt_object.flags);
  626.             gui_measure_string(s, &w, &h);
  627.             /* get current tiem in string format */
  628.             x1 = main_LCD_dt_object.time.x = x;
  629.             y1 = main_LCD_dt_object.time.y = y;
  630.             main_LCD_dt_object.time.width = w;
  631.             main_LCD_dt_object.time.height = h;
  632.             if (enable_main_LCD_date_time_display)
  633.             {
  634.                 gui_set_text_color(main_LCD_dt_object.time.text_color);
  635.                 if (r2lMMIFlag)
  636.                 {
  637.                     gui_move_text_cursor(x + main_LCD_dt_object.time.width - 1, y);
  638.                 }
  639.                 else
  640.                 {
  641.                     gui_move_text_cursor(x, y);
  642.                 }
  643.                 x2 = x1 + main_LCD_dt_object.time.width - 1;
  644.                 y2 = y1 + main_LCD_dt_object.time.height - 1;
  645.                 gui_set_text_clip(x1, y1, x2, y2);
  646.                 /* print time */
  647.                 gui_print_text(s);
  648.                 gdi_layer_blt_previous(
  649.                     x1 < old_x1 ? x1 : old_x1,
  650.                     y1 < old_y1 ? y1 : old_y1,
  651.                     x2 > old_x2 ? x2 : old_x2,
  652.                     y2 > old_y2 ? y2 : old_y2);
  653.             }
  654.             if (enable_main_LCD_date_time_display)
  655.             {
  656.                 dm_coordinates coordinates;
  657.                 coordinates.s16X = main_LCD_dt_object.time.x;
  658.                 coordinates.s16Y = main_LCD_dt_object.time.y;
  659.                 coordinates.s16Width = main_LCD_dt_object.time.width;
  660.                 coordinates.s16Height = main_LCD_dt_object.time.height;
  661.                 setup_previous_control(&coordinates);
  662.             }
  663.         }
  664.             break;
  665.         case DT_MT_CALL_SCREEN:
  666.         {
  667.             y = (MMI_title_y + MMI_title_height);
  668.         #ifdef __MMI_UI_DALMATIAN_STATUSBAR__
  669.             y = MMI_status_bar_height;
  670.         #endif 
  671.             gui_set_font(main_LCD_dt_object.date.font);
  672.             /* get current date in string format */
  673.             date_string(&main_LCD_dt_object.date.t, (UI_string_type) s, main_LCD_dt_object.flags);
  674.             gui_measure_string(s, &w, &h);
  675.             x = 2;
  676.             x1 = main_LCD_dt_object.date.x = x;
  677.             y1 = main_LCD_dt_object.date.y = y;
  678.             main_LCD_dt_object.date.width = w;
  679.             main_LCD_dt_object.date.height = h;
  680.             if (enable_main_LCD_date_time_display)
  681.             {
  682.                 gui_set_text_color(main_LCD_dt_object.date.text_color);
  683.                 if (r2lMMIFlag)
  684.                 {
  685.                     gui_move_text_cursor(x + main_LCD_dt_object.date.width - 1, y);
  686.                 }
  687.                 else
  688.                 {
  689.                     gui_move_text_cursor(x, y);
  690.                 }
  691.                 x2 = x1 + main_LCD_dt_object.date.width - 1;
  692.                 y2 = y1 + main_LCD_dt_object.date.height - 1;
  693.                 /* print date */
  694.                 gui_print_text(s);
  695.                 if (x1 < old_x1)
  696.                 {
  697.                     old_x1 = x1;
  698.                 }
  699.                 if (y1 < old_y1)
  700.                 {
  701.                     old_y1 = y1;
  702.                 }
  703.                 if (x2 > old_x2)
  704.                 {
  705.                     old_x2 = x2;
  706.                 }
  707.                 if (y2 > old_y2)
  708.                 {
  709.                     old_y2 = y2;
  710.                 }
  711.             }
  712.             gui_set_font(main_LCD_dt_object.time.font);
  713.             time_string(&main_LCD_dt_object.time.t, (UI_string_type) s, main_LCD_dt_object.flags);
  714.             gui_measure_string(s, &w, &h);
  715.             x = 2;
  716.             y = y + h;
  717.             /* get current time in string format */
  718.             x1 = main_LCD_dt_object.time.x = x;
  719.             y1 = main_LCD_dt_object.time.y = y;
  720.             main_LCD_dt_object.time.width = w;
  721.             main_LCD_dt_object.time.height = h;
  722.             if (enable_main_LCD_date_time_display)
  723.             {
  724.                 gui_set_text_color(main_LCD_dt_object.time.text_color);
  725.                 if (r2lMMIFlag)
  726.                 {
  727.                     gui_move_text_cursor(x + main_LCD_dt_object.time.width - 1, y);
  728.                 }
  729.                 else
  730.                 {
  731.                     gui_move_text_cursor(x, y);
  732.                 }
  733.                 x2 = x1 + main_LCD_dt_object.time.width - 1;
  734.                 y2 = y1 + main_LCD_dt_object.time.height - 1;
  735.                 /* print time */
  736.                 gui_print_text(s);
  737.                 gdi_layer_blt_previous(
  738.                     x1 < old_x1 ? x1 : old_x1,
  739.                     y1 < old_y1 ? y1 : old_y1,
  740.                     x2 > old_x2 ? x2 : old_x2,
  741.                     y2 > old_y2 ? y2 : old_y2);
  742.             }
  743.             if (enable_main_LCD_date_time_display)
  744.             {
  745.                 dm_coordinates coordinates;
  746.                 coordinates.s16X = main_LCD_dt_object.time.x;
  747.                 coordinates.s16Y = main_LCD_dt_object.time.y;
  748.                 coordinates.s16Width = main_LCD_dt_object.time.width;
  749.                 coordinates.s16Height = main_LCD_dt_object.time.height;
  750.                 setup_previous_control(&coordinates);
  751.             }
  752.         }
  753.             break;
  754.         case DT_TABBED_CALL_SCREEN:
  755.         case DT_ACTIVE_CALL_SCREEN:
  756.         {
  757.             if ((main_LCD_dt_object.flags & DT_FLAGS_TYPE) == DT_ACTIVE_CALL_SCREEN)//080106 active call
  758.             {
  759.                 y = MMI_status_bar_height;
  760.             }
  761.             else
  762.             {
  763.                 y = MMI_CONTENT_Y + MMI_HORIZONTAL_TAB_BAR_TAB_AREA_HEIGHT + MMI_HORIZONTAL_TAB_BAR_HINT_AREA_HEIGHT -
  764.                     MMI_TITLE_HEIGHT;
  765.             }
  766.             gui_set_font(main_LCD_dt_object.date.font);
  767.             /* get current date in string format */
  768.             date_string(&main_LCD_dt_object.date.t, (UI_string_type) s, main_LCD_dt_object.flags);
  769.             gui_measure_string(s, &w, &h);
  770.             x = 2;
  771.             x1 = main_LCD_dt_object.date.x = x;
  772.             y1 = main_LCD_dt_object.date.y = y;
  773.             main_LCD_dt_object.date.width = w;
  774.             main_LCD_dt_object.date.height = h;
  775.             if (enable_main_LCD_date_time_display)
  776.             {
  777.                 gui_set_text_color(main_LCD_dt_object.date.text_color);
  778.                 if (r2lMMIFlag)
  779.                 {
  780.                     gui_move_text_cursor(x + main_LCD_dt_object.date.width - 1, y);
  781.                 }
  782.                 else
  783.                 {
  784.                     gui_move_text_cursor(x, y);
  785.                 }
  786.                 x2 = UI_device_width - 1;
  787.                 y2 = y1 + main_LCD_dt_object.date.height - 1;
  788.                 /* print date */
  789.                 gui_print_text(s);
  790.                 if (x1 < old_x1)
  791.                 {
  792.                     old_x1 = x1;
  793.                 }
  794.                 if (y1 < old_y1)
  795.                 {
  796.                     old_y1 = y1;
  797.                 }
  798.                 if (x2 > old_x2)
  799.                 {
  800.                     old_x2 = x2;
  801.                 }
  802.                 if (y2 > old_y2)
  803.                 {
  804.                     old_y2 = y2;
  805.                 }
  806.             }
  807.             gui_set_font(main_LCD_dt_object.time.font);
  808.             /* get current time in string format */
  809.             time_string(&main_LCD_dt_object.time.t, (UI_string_type) s, main_LCD_dt_object.flags);
  810.             gui_measure_string(s, &w, &h);
  811.             x = 2;
  812.             y = y + h;
  813.             x1 = main_LCD_dt_object.time.x = x;
  814.             y1 = main_LCD_dt_object.time.y = y;
  815.             main_LCD_dt_object.time.width = w;
  816.             main_LCD_dt_object.time.height = h;
  817.             if (enable_main_LCD_date_time_display)
  818.             {
  819.                 gui_set_text_color(main_LCD_dt_object.time.text_color);
  820.                 if (r2lMMIFlag)
  821.                 {
  822.                     gui_move_text_cursor(x + main_LCD_dt_object.time.width - 1, y);
  823.                 }
  824.                 else
  825.                 {
  826.                     gui_move_text_cursor(x, y);
  827.                 }
  828.                 x2 = x1 + main_LCD_dt_object.time.width - 1;
  829.                 y2 = y1 + main_LCD_dt_object.time.height - 1;
  830.                 /* print time */
  831.                 gui_print_text(s);
  832.                 gdi_layer_blt_previous(
  833.                     x1 < old_x1 ? x1 : old_x1,
  834.                     y1 < old_y1 ? y1 : old_y1,
  835.                     x2 > old_x2 ? x2 : old_x2,
  836.                     y2 > old_y2 ? y2 : old_y2);
  837.             }
  838.             if (!(FALSE == GetCallTimeDisplay()))
  839.             {
  840.                 gui_set_font(main_LCD_dt_object.duration.font);
  841.                 x = 2;
  842.                 y = y + h;
  843.                 /* get call duration in string format */
  844.                 duration_string(&main_LCD_dt_object.duration.t, (UI_string_type) s, main_LCD_dt_object.flags);
  845.                 gui_measure_string(s, &w, &h);
  846.                 x1 = main_LCD_dt_object.duration.x = x;
  847.                 y1 = main_LCD_dt_object.duration.y = y;
  848.                 main_LCD_dt_object.duration.width = (UI_device_width >> 1) + 16;
  849.                 main_LCD_dt_object.duration.height = h;
  850.                 if (enable_main_LCD_date_time_display)
  851.                 {
  852.                     gui_set_text_color(main_LCD_dt_object.duration.text_color);
  853.                     if (r2lMMIFlag)
  854.                     {
  855.                         gui_move_text_cursor(x + w - 1, y);
  856.                     }
  857.                     else
  858.                     {
  859.                         gui_move_text_cursor(x, y);
  860.                     }
  861.                     x2 = x1 + main_LCD_dt_object.duration.width - 1;
  862.                     y2 = y1 + main_LCD_dt_object.duration.height - 1;
  863.                     /* display call duration in active acll screen */
  864.                     gui_print_text(s);
  865.                     gdi_layer_blt_previous(
  866.                         x1 < old_x1 ? x1 : old_x1,
  867.                         y1 < old_y1 ? y1 : old_y1,
  868.                         x2 > old_x2 ? x2 : old_x2,
  869.                         y2 > old_y2 ? y2 : old_y2);
  870.                 }
  871.             }
  872.             else
  873.             {
  874.                 y = y + h;
  875.                 x1 = main_LCD_dt_object.duration.x = x;
  876.                 if (GetTotalActiveCallCount() + GetTotalHoldCallCount() != 1)
  877.                 {
  878.                     y1 = main_LCD_dt_object.duration.y = main_LCD_dt_object.date.y + main_LCD_dt_object.date.height;
  879.                 }
  880.                 else
  881.                 {
  882.                     y1 = main_LCD_dt_object.duration.y = y;
  883.                 }
  884.                 main_LCD_dt_object.duration.width = (UI_device_width >> 1) + 16;
  885.                 main_LCD_dt_object.duration.height = h;
  886.             }
  887.             if (enable_main_LCD_date_time_display)
  888.             {
  889.                 dm_coordinates coordinates;
  890.                 coordinates.s16X = main_LCD_dt_object.duration.x;
  891.                 coordinates.s16Y = main_LCD_dt_object.duration.y;
  892.                 coordinates.s16Width = main_LCD_dt_object.duration.width;
  893.                 coordinates.s16Height = main_LCD_dt_object.duration.height;
  894.                 setup_previous_control(&coordinates);
  895.             }
  896.         }
  897.             break;
  898.         case DT_DIGITAL_CLOCK_SC1:
  899.         {
  900.             gui_set_font(main_LCD_dt_object.time.font);
  901.             /* get current tiem in string format */
  902.             time_string(&main_LCD_dt_object.time.t, (UI_string_type) s, main_LCD_dt_object.flags);
  903.             gui_measure_string(s, &w, &h);
  904.             x = (UI_device_width >> 1) - (w >> 1);
  905.             y = (UI_device_height >> 1) - (h >> 1);
  906.             x1 = main_LCD_dt_object.time.x = x;
  907.             y1 = main_LCD_dt_object.time.y = y;
  908.             main_LCD_dt_object.time.width = w + (DT_DISPLAY_GAP << 1);
  909.             main_LCD_dt_object.time.height = h + (DT_DISPLAY_GAP << 1);
  910.             if (enable_main_LCD_date_time_display)
  911.             {
  912.                 gui_set_text_color(main_LCD_dt_object.time.text_color);
  913.                 gui_set_text_border_color(main_LCD_dt_object.time.text_border_color);
  914.                 if (r2lMMIFlag)
  915.                 {
  916.                     gui_move_text_cursor(x + main_LCD_dt_object.time.width - 1, y + 1);
  917.                 }
  918.                 else
  919.                 {
  920.                     gui_move_text_cursor(x, y + 1);
  921.                 }
  922.                 x2 = x1 + main_LCD_dt_object.time.width - 1;
  923.                 y2 = y1 + main_LCD_dt_object.time.height - 1;
  924.             #ifdef __MMI_UI_DALMATIAN_IDLESCREEN__
  925.                 gui_set_text_clip(x1 - 1, y1, x2, y2);
  926.             #else 
  927.                 gui_set_text_clip(x1, y1, x2, y2);
  928.             #endif 
  929.                 /* print time */
  930.                 gui_print_bordered_text(s);
  931.                 if (show_date == 0)
  932.                 {
  933.                     if (x1 < old_x1)
  934.                     {
  935.                         old_x1 = x1;
  936.                     }
  937.                     if (y1 < old_y1)
  938.                     {
  939.                         old_y1 = y1;
  940.                     }
  941.                     if (x2 > old_x2)
  942.                     {
  943.                         old_x2 = x2;
  944.                     }
  945.                     if (y2 > old_y2)
  946.                     {
  947.                         old_y2 = y2;
  948.                     }
  949.                 }
  950.                 else
  951.                 {
  952.                     gdi_layer_blt_previous(
  953.                         x1 < old_x1 ? x1 : old_x1,
  954.                         y1 < old_y1 ? y1 : old_y1,
  955.                         x2 > old_x2 ? x2 : old_x2,
  956.                         y2 > old_y2 ? y2 : old_y2);
  957.                 }
  958.             }
  959.             if (show_date == 0) /* if display date time is enable */
  960.             {
  961.                 gui_set_font(main_LCD_dt_object.date.font);
  962.                 /* get current date in string format */
  963.                 date_string(&main_LCD_dt_object.date.t, (UI_string_type) s, main_LCD_dt_object.flags);
  964.                 gui_measure_string(s, &w, &h);
  965.                 x = (UI_device_width >> 1) - (w >> 1);
  966.             #ifdef __MMI_UI_STATUS_BAR_AT_BOTTOM__
  967.                 if (is_on_idlescreen())
  968.                 {
  969.                     y = DT_DISPLAY_OFFSET_IN_STATUS_BAR_AT_BOTTOM;
  970.                 }
  971.                 else
  972.             #endif /* __MMI_UI_STATUS_BAR_AT_BOTTOM__ */ 
  973.             #if defined(__MMI_TOUCH_IDLESCREEN_SHORTCUTS__)
  974.                     /* change in value of y, when idlescreen shortcuts are enabled. */
  975.                     y = UI_device_height - max_touch_idle_screen_shortcut_height() - h - 4;
  976.             #else /* defined(__MMI_TOUCH_IDLESCREEN_SHORTCUTS__) */ 
  977.                     y = UI_device_height - MMI_button_bar_height - h - 4;
  978.             #endif /* defined(__MMI_TOUCH_IDLESCREEN_SHORTCUTS__) */ 
  979.                 x1 = main_LCD_dt_object.date.x = x;
  980.                 y1 = main_LCD_dt_object.date.y = y;
  981.                 main_LCD_dt_object.date.width = w + (DT_DISPLAY_GAP << 1);
  982.                 main_LCD_dt_object.date.height = h + (DT_DISPLAY_GAP << 1);
  983.                 if (enable_main_LCD_date_time_display)
  984.                 {
  985.                     gui_set_text_color(main_LCD_dt_object.date.text_color);
  986.                     gui_set_text_border_color(main_LCD_dt_object.date.text_border_color);
  987.                     if (r2lMMIFlag)
  988.                     {
  989.                         gui_move_text_cursor(x + main_LCD_dt_object.date.width - 1, y + 1);
  990.                     }
  991.                     else
  992.                     {
  993.                         gui_move_text_cursor(x, y + 1);
  994.                     }
  995.                     x2 = x1 + main_LCD_dt_object.date.width - 1;
  996.                     y2 = y1 + main_LCD_dt_object.date.height - 1;
  997.                 #ifdef __MMI_UI_DALMATIAN_IDLESCREEN__
  998.                     gui_set_text_clip(x1 - 1, y1, x2, y2);
  999.                 #else 
  1000.                     gui_set_text_clip(x1, y1, x2, y2);
  1001.                 #endif 
  1002.                     /* print date */
  1003.                     gui_print_bordered_text(s);
  1004.                     gdi_layer_blt_previous(
  1005.                         x1 < old_x1 ? x1 : old_x1,
  1006.                         y1 < old_y1 ? y1 : old_y1,
  1007.                         x2 > old_x2 ? x2 : old_x2,
  1008.                         y2 > old_y2 ? y2 : old_y2);
  1009.                 }
  1010.             }   /* show_date == 0 */
  1011.         #ifdef __MMI_UI_STATUS_BAR_AT_BOTTOM__
  1012.             if (is_on_idlescreen())
  1013.             {
  1014.                 gdi_layer_push_clip();
  1015.                 gui_set_clip(
  1016.                     0,
  1017.                     0,
  1018.                     UI_device_width - 1,
  1019.                     UI_device_height - 1 - MMI_button_bar_height - MMI_status_bar_height - 2 - 1);
  1020.                 show_boundries_to_status_bar_at_bottom_idlescreen();
  1021.                 gdi_layer_pop_clip();
  1022.                 gdi_layer_blt_previous(
  1023.                     0,
  1024.                     0,
  1025.                     (UI_device_width - 1),
  1026.                     (UI_device_height - 1 - MMI_button_bar_height - MMI_status_bar_height - 1 - 2));
  1027.             }
  1028.         #endif /* __MMI_UI_STATUS_BAR_AT_BOTTOM__ */ 
  1029.             if (enable_main_LCD_date_time_display)
  1030.             {
  1031.                 dm_coordinates coordinates;
  1032.                 if (show_date == 0)
  1033.                 {
  1034.                     coordinates.s16X = main_LCD_dt_object.date.x;
  1035.                     coordinates.s16Y = main_LCD_dt_object.date.y;
  1036.                     coordinates.s16Width = main_LCD_dt_object.date.width;
  1037.                     coordinates.s16Height = main_LCD_dt_object.date.height;
  1038.                     setup_previous_control(&coordinates);
  1039.                 }
  1040.                 else
  1041.                 {
  1042.                     coordinates.s16X = main_LCD_dt_object.time.x;
  1043.                     coordinates.s16Y = main_LCD_dt_object.time.y;
  1044.                     coordinates.s16Width = main_LCD_dt_object.time.width;
  1045.                     coordinates.s16Height = main_LCD_dt_object.time.height;
  1046.                     setup_previous_control(&coordinates);
  1047.                 }
  1048.             }
  1049.         }
  1050.             break;
  1051.         case DT_DIGITAL_CLOCK_SC2:
  1052.         {
  1053.             gui_set_font(main_LCD_dt_object.date.font);
  1054.             /* get current date in string format */
  1055.             date_string(&main_LCD_dt_object.date.t, (UI_string_type) s, main_LCD_dt_object.flags);
  1056.             gui_measure_string(s, &w, &h);
  1057.             x = (UI_device_width >> 1) - (w >> 1);
  1058.         #ifdef __MMI_UI_STATUS_BAR_AT_BOTTOM__
  1059.             if (is_on_idlescreen())
  1060.             {
  1061.                 y = DT_DISPLAY_OFFSET_IN_STATUS_BAR_AT_BOTTOM;
  1062.             }
  1063.             else
  1064.         #endif /* __MMI_UI_STATUS_BAR_AT_BOTTOM__ */ 
  1065.                 y = UI_device_height - MMI_button_bar_height - (h + (DT_DISPLAY_GAP << 1)) - 4;
  1066.             x1 = main_LCD_dt_object.date.x = x;
  1067.             y1 = main_LCD_dt_object.date.y = y;
  1068.             main_LCD_dt_object.date.width = w + (DT_DISPLAY_GAP << 1);
  1069.             main_LCD_dt_object.date.height = h + (DT_DISPLAY_GAP << 1);
  1070.             if (enable_main_LCD_date_time_display)
  1071.             {
  1072.                 gui_set_text_color(main_LCD_dt_object.date.text_color);
  1073.                 gui_set_text_border_color(main_LCD_dt_object.date.text_border_color);
  1074.                 if (r2lMMIFlag)
  1075.                 {
  1076.                     gui_move_text_cursor(x + main_LCD_dt_object.date.width - 1, y + 1);
  1077.                 }
  1078.                 else
  1079.                 {
  1080.                     gui_move_text_cursor(x, y + 1);
  1081.                 }
  1082.                 x2 = x1 + main_LCD_dt_object.date.width - 1;
  1083.                 y2 = y1 + main_LCD_dt_object.date.height - 1;
  1084.                 /* print date */
  1085.                 gui_print_bordered_text(s);
  1086.                 gdi_layer_blt_previous(
  1087.                     x1 < old_x1 ? x1 : old_x1,
  1088.                     y1 < old_y1 ? y1 : old_y1,
  1089.                     x2 > old_x2 ? x2 : old_x2,
  1090.                     y2 > old_y2 ? y2 : old_y2);
  1091.             }
  1092.         #ifdef __MMI_UI_STATUS_BAR_AT_BOTTOM__
  1093.             if (is_on_idlescreen())
  1094.             {
  1095.                 gdi_layer_push_clip();
  1096.                 gui_set_clip(
  1097.                     0,
  1098.                     0,
  1099.                     UI_device_width - 1,
  1100.                     UI_device_height - 1 - MMI_button_bar_height - MMI_status_bar_height - 2 - 1);
  1101.                 show_boundries_to_status_bar_at_bottom_idlescreen();
  1102.                 gdi_layer_pop_clip();
  1103.                 gdi_layer_blt_previous(
  1104.                     0,
  1105.                     0,
  1106.                     (UI_device_width - 1),
  1107.                     (UI_device_height - 1 - MMI_button_bar_height - MMI_status_bar_height - 1 - 2));
  1108.             }
  1109.         #endif /* __MMI_UI_STATUS_BAR_AT_BOTTOM__ */ 
  1110.             if (enable_main_LCD_date_time_display)
  1111.             {
  1112.                 dm_coordinates coordinates;
  1113.                 coordinates.s16X = main_LCD_dt_object.date.x;
  1114.                 coordinates.s16Y = main_LCD_dt_object.date.y;
  1115.                 coordinates.s16Width = main_LCD_dt_object.date.width;
  1116.                 coordinates.s16Height = main_LCD_dt_object.date.height;
  1117.                 setup_previous_control(&coordinates);
  1118.             }
  1119.         }
  1120.             break;
  1121.         case DT_DIGITAL_CLOCK_SC3:
  1122.         {
  1123.             gui_set_font(main_LCD_dt_object.time.font);
  1124.             /* get time in string format */
  1125.             time_string(&main_LCD_dt_object.time.t, (UI_string_type) s, main_LCD_dt_object.flags);
  1126.             gui_measure_string(s, &w, &h);
  1127.             x = (UI_device_width >> 1) - (w >> 1);
  1128.             y = (UI_device_height >> 1) - (h >> 1);
  1129.             x1 = main_LCD_dt_object.time.x = x;
  1130.             y1 = main_LCD_dt_object.time.y = y;
  1131.             main_LCD_dt_object.time.width = w + (DT_DISPLAY_GAP << 1);
  1132.             main_LCD_dt_object.time.height = h + (DT_DISPLAY_GAP << 1);
  1133.             if (enable_main_LCD_date_time_display)
  1134.             {
  1135.                 gui_set_text_color(main_LCD_dt_object.time.text_color);
  1136.                 gui_set_text_border_color(main_LCD_dt_object.time.text_border_color);
  1137.                 if (r2lMMIFlag)
  1138.                 {
  1139.                     gui_move_text_cursor(x + main_LCD_dt_object.time.width - 1, y + 1);
  1140.                 }
  1141.                 else
  1142.                 {
  1143.                     gui_move_text_cursor(x, y + 1);
  1144.                 }
  1145.                 x2 = x1 + main_LCD_dt_object.time.width - 1;
  1146.                 y2 = y1 + main_LCD_dt_object.time.height - 1;
  1147.                 /* print time */
  1148.                 gui_print_bordered_text(s);
  1149.                 gdi_layer_blt_previous(
  1150.                     x1 < old_x1 ? x1 : old_x1,
  1151.                     y1 < old_y1 ? y1 : old_y1,
  1152.                     x2 > old_x2 ? x2 : old_x2,
  1153.                     y2 > old_y2 ? y2 : old_y2);
  1154.             }
  1155.         #ifdef __MMI_UI_STATUS_BAR_AT_BOTTOM__
  1156.             if (is_on_idlescreen())
  1157.             {
  1158.                 gdi_layer_push_clip();
  1159.                 gdi_layer_set_clip(
  1160.                     0,
  1161.                     0,
  1162.                     UI_device_width - 1,
  1163.                     UI_device_height - 1 - MMI_button_bar_height - MMI_status_bar_height - 2 - 1);
  1164.                 show_boundries_to_status_bar_at_bottom_idlescreen();
  1165.                 gdi_layer_pop_clip();
  1166.                 gdi_layer_blt_previous(
  1167.                     0,
  1168.                     0,
  1169.                     (UI_device_width - 1),
  1170.                     (UI_device_height - 1 - MMI_button_bar_height - MMI_status_bar_height - 1 - 2));
  1171.             }
  1172.         #endif /* __MMI_UI_STATUS_BAR_AT_BOTTOM__ */ 
  1173.             if (enable_main_LCD_date_time_display)
  1174.             {
  1175.                 dm_coordinates coordinates;
  1176.                 coordinates.s16X = main_LCD_dt_object.time.x;
  1177.                 coordinates.s16Y = main_LCD_dt_object.time.y;
  1178.                 coordinates.s16Width = main_LCD_dt_object.time.width;
  1179.                 coordinates.s16Height = main_LCD_dt_object.time.height;
  1180.                 setup_previous_control(&coordinates);
  1181.             }
  1182.         }
  1183.             break;
  1184.     #ifdef __MMI_ANALOG_CLOCK__
  1185.         case DT_ANALOG_CLOCK_SC:
  1186.         {
  1187.         #ifdef __MMI_UI_STATUS_BAR_AT_BOTTOM__
  1188.             if (is_on_idlescreen())
  1189.             {
  1190.                 gdi_layer_push_clip();
  1191.                 gui_set_clip(
  1192.                     0,
  1193.                     0,
  1194.                     UI_device_width - 1,
  1195.                     UI_device_height - 1 - MMI_button_bar_height - MMI_status_bar_height - 2 - 1);
  1196.             }
  1197.         #endif /* __MMI_UI_STATUS_BAR_AT_BOTTOM__ */ 
  1198.             if (enable_main_LCD_date_time_display)
  1199.             {
  1200.                 gdi_layer_lock_frame_buffer();
  1201.                 show_analog_clock();
  1202.             }
  1203.             if (show_date == 0)
  1204.             {
  1205.                 gui_set_font(&MMI_medium_font);
  1206.                 /* get current date in string format */
  1207.                 date_string(&main_LCD_dt_object.date.t, (UI_string_type) s, main_LCD_dt_object.flags);
  1208.                 gui_measure_string(s, &w, &h);
  1209.                 x = (UI_device_width >> 1) - (w >> 1);
  1210.             #ifdef __MMI_UI_STATUS_BAR_AT_BOTTOM__
  1211.                 if (is_on_idlescreen())
  1212.                 {
  1213.                     y = DT_DISPLAY_OFFSET_IN_STATUS_BAR_AT_BOTTOM;
  1214.                 }
  1215.                 else
  1216.             #endif /* __MMI_UI_STATUS_BAR_AT_BOTTOM__ */ 
  1217.             #if defined(__MMI_TOUCH_IDLESCREEN_SHORTCUTS__)
  1218.                     /* change in value of y, when idlescreen shortcuts are enabled. */
  1219.                     y = UI_device_height - max_touch_idle_screen_shortcut_height() - (h + (DT_DISPLAY_GAP << 1));
  1220.             #else /* defined(__MMI_TOUCH_IDLESCREEN_SHORTCUTS__) */ 
  1221.                     y = UI_device_height - MMI_button_bar_height - (h + (DT_DISPLAY_GAP << 1));
  1222.             #endif /* defined(__MMI_TOUCH_IDLESCREEN_SHORTCUTS__) */ 
  1223.                 x1 = main_LCD_dt_object.date.x = x;
  1224.                 y1 = main_LCD_dt_object.date.y = y;
  1225.                 main_LCD_dt_object.date.width = w + (DT_DISPLAY_GAP << 1);
  1226.                 main_LCD_dt_object.date.height = h + (DT_DISPLAY_GAP << 1);
  1227.                 if (enable_main_LCD_date_time_display)
  1228.                 {
  1229.                     gui_set_text_color(main_LCD_dt_object.date.text_color);
  1230.                     gui_set_text_border_color(main_LCD_dt_object.date.text_border_color);
  1231.                     if (r2lMMIFlag)
  1232.                     {
  1233.                         gui_move_text_cursor(x + main_LCD_dt_object.date.width - 1, y + 1);
  1234.                     }
  1235.                     else
  1236.                     {
  1237.                         gui_move_text_cursor(x, y + 1);
  1238.                     }
  1239.                     x2 = x1 + main_LCD_dt_object.date.width - 1;
  1240.                     y2 = y1 + main_LCD_dt_object.date.height - 1;
  1241.                 #ifdef __MMI_UI_DALMATIAN_IDLESCREEN__
  1242.                     gui_set_text_clip(x1 - 1, y1, x2, y2);
  1243.                 #else 
  1244.                     gui_set_text_clip(x1, y1, x2, y2);
  1245.                 #endif 
  1246.                     /* print date */
  1247.                     gui_print_bordered_text(s);
  1248.                 }
  1249.             }
  1250.         #ifdef __MMI_UI_STATUS_BAR_AT_BOTTOM__
  1251.             if (is_on_idlescreen())
  1252.             {
  1253.                 gdi_layer_pop_clip();
  1254.                 show_boundries_to_status_bar_at_bottom_idlescreen();
  1255.             }
  1256.         #endif /* __MMI_UI_STATUS_BAR_AT_BOTTOM__ */ 
  1257.             if (enable_main_LCD_date_time_display)
  1258.             {
  1259.                 gdi_layer_unlock_frame_buffer();
  1260.             #if defined(__MMI_TOUCH_IDLESCREEN_SHORTCUTS__)
  1261.                 gdi_layer_blt_previous(
  1262.                     0,
  1263.                     (MMI_title_y + MMI_title_height),
  1264.                     (UI_device_width - 1),
  1265.                     (UI_device_height - max_touch_idle_screen_shortcut_height() - 1));
  1266.             #else /* defined(__MMI_TOUCH_IDLESCREEN_SHORTCUTS__) */ 
  1267.             #ifdef __MMI_UI_STATUS_BAR_AT_BOTTOM__
  1268.                 if (is_on_idlescreen())
  1269.                 {
  1270.                     gdi_layer_blt_previous(
  1271.                         0,
  1272.                         0,
  1273.                         (UI_device_width - 1),
  1274.                         (UI_device_height - 1 - MMI_button_bar_height - MMI_status_bar_height - 1 - 2));
  1275.                 }
  1276.                 else
  1277.             #endif /* __MMI_UI_STATUS_BAR_AT_BOTTOM__ */ 
  1278.                     gdi_layer_blt_previous(
  1279.                         0,
  1280.                         (MMI_title_y + MMI_title_height),
  1281.                         (UI_device_width - 1),
  1282.                         (UI_device_height - 1));
  1283.             #endif /* defined(__MMI_TOUCH_IDLESCREEN_SHORTCUTS__) */ 
  1284.             }
  1285.             if (enable_main_LCD_date_time_display)
  1286.             {
  1287.                 dm_coordinates coordinates;
  1288.                 if (show_date == 0)
  1289.                 {
  1290.                     coordinates.s16X = main_LCD_dt_object.date.x;
  1291.                     coordinates.s16Y = main_LCD_dt_object.date.y;
  1292.                     coordinates.s16Width = main_LCD_dt_object.date.width;
  1293.                     coordinates.s16Height = main_LCD_dt_object.date.height;
  1294.                     setup_previous_control(&coordinates);
  1295.                 }
  1296.                 else
  1297.                 {
  1298.                     coordinates.s16X = ANALOG_CLOCK_DIAL_X;
  1299.                     coordinates.s16Y = ANALOG_CLOCK_DIAL_Y;
  1300.                     coordinates.s16Width = ANALOG_CLOCK_DIAL_WIDTH;
  1301.                     coordinates.s16Height = ANALOG_CLOCK_DIAL_HEIGHT;
  1302.                     setup_previous_control(&coordinates);
  1303.                 }
  1304.             }
  1305.         }
  1306.             break;
  1307.     #endif /* __MMI_ANALOG_CLOCK__ */ 
  1308.     }
  1309.     gdi_layer_pop_clip();
  1310.     if (saved_graphics_context == &main_LCD_device_bitmap)
  1311.     {
  1312.         UI_set_main_LCD_graphics_context();
  1313.     }
  1314.     else if (saved_graphics_context == &sub_LCD_device_bitmap)
  1315.     {
  1316.         UI_set_sub_LCD_graphics_context();
  1317.     }
  1318. }
  1319. /*****************************************************************************
  1320.  * FUNCTION
  1321.  *  hide_main_LCD_date_time
  1322.  * DESCRIPTION
  1323.  *  hide function of main lcd date time
  1324.  * PARAMETERS
  1325.  *  void
  1326.  * RETURNS
  1327.  *  void
  1328.  *****************************************************************************/
  1329. void hide_main_LCD_date_time(void)
  1330. {
  1331.     /*----------------------------------------------------------------*/
  1332.     /* Local Variables                                                */
  1333.     /*----------------------------------------------------------------*/
  1334.     S32 x1, y1, x2, y2;
  1335.     bitmap *saved_graphics_context = current_LCD_device_bitmap;
  1336.     /*----------------------------------------------------------------*/
  1337.     /* Code Body                                                      */
  1338.     /*----------------------------------------------------------------*/
  1339.     if (main_lcd_update_date_time == MMI_FALSE)
  1340.     {
  1341.         return;
  1342.     }
  1343.     UI_set_main_LCD_graphics_context();
  1344.     switch (main_LCD_dt_object.flags & DT_FLAGS_TYPE)
  1345.     {
  1346.         case DT_IDLE_SCREEN:
  1347.         case DT_IDLE_SCREEN_2:
  1348.         case DT_NETWORK_SEARCH:
  1349.         case DT_MO_CALL_SCREEN:
  1350.         case DT_MO_CALLING_SCREEN:
  1351.         case DT_MT_CALL_SCREEN:
  1352.         {
  1353.             /*
  1354.              * MTK Justin
  1355.              * 
  1356.              * Note that we should hide "date" first, then hide "time".
  1357.              * The sequence should not be changed.
  1358.              * 
  1359.              * This is for a hack for optimizing the speed of redraw background image.
  1360.              * Please refer to  idle_screen_hide_date_display and
  1361.              * idle_screen_hide_time_display
  1362.              * 
  1363.              * MTK Justin end
  1364.              */
  1365.             x1 = main_LCD_dt_object.date.x;
  1366.             y1 = main_LCD_dt_object.date.y;
  1367.             x2 = main_LCD_dt_object.date.width + x1 - 1;
  1368.             y2 = main_LCD_dt_object.date.height + y1 - 1;
  1369.             main_LCD_dt_object.date.hide_function(x1, y1, x2, y2);
  1370.             //KP Jerry modify for time display overlap between new and old time on 2006-11-16 start
  1371.             /*Old:
  1372.             if (x1 > main_LCD_dt_object.time.x)
  1373.             {
  1374.                 x1 = main_LCD_dt_object.time.x;
  1375.             }
  1376.             y1 = main_LCD_dt_object.date.y - 1;
  1377.             if (x2 < main_LCD_dt_object.time.width + main_LCD_dt_object.time.x)
  1378.             {
  1379.                 x2 = main_LCD_dt_object.time.width + main_LCD_dt_object.time.x - 1;
  1380.             }
  1381.             y2 = main_LCD_dt_object.time.y + main_LCD_dt_object.time.height - 1;
  1382.             main_LCD_dt_object.time.hide_function(x1, y1, x2, y2);      // call hide function of idle,netwroksearch,call screen 
  1383.             */
  1384.             x1=main_LCD_dt_object.time.x;
  1385.             y1=main_LCD_dt_object.time.y;
  1386.             x2=main_LCD_dt_object.time.width+x1-1;
  1387.             y2=main_LCD_dt_object.time.height+y1-1;
  1388.             main_LCD_dt_object.date.hide_function(x1,y1,x2,y2);
  1389.             //KP Jerry modify for time display overlap between new and old time on 2006-11-16 end
  1390.         #ifdef __MMI_UI_TECHNO_IDLESCREEN_BAR__
  1391.             if ((main_LCD_dt_object.flags & DT_FLAGS_TYPE) == DT_IDLE_SCREEN)
  1392.             {
  1393.                 x1 = ANALOG_BACKGROUND_X + ANALOG_BACKGROUND_WIDTH;
  1394.                 y1 = MMI_status_bar_height + (MMI_IDLESCREEN_BAR_HEIGHT >> 1);
  1395.                 x2 = UI_device_width - MMI_SIGNAL_WIDTH;
  1396.                 y2 = y1 + (MMI_IDLESCREEN_BAR_HEIGHT >> 1);
  1397.                 MMI_main_LCD_dt_day_hide_function(x1, y1, x2, y2);
  1398.             }
  1399.         #endif /* __MMI_UI_TECHNO_IDLESCREEN_BAR__ */ 
  1400.         }
  1401.             break;
  1402.         case DT_TABBED_CALL_SCREEN:
  1403.         case DT_ACTIVE_CALL_SCREEN:
  1404.         {
  1405.             x1 = main_LCD_dt_object.date.x;
  1406.             y1 = main_LCD_dt_object.date.y;
  1407.             x2 = main_LCD_dt_object.date.width + x1 - 1;
  1408.             y2 = main_LCD_dt_object.date.height + y1 - 1;
  1409.             if (main_LCD_dt_object.flags & DT_FLAGS_TYPE == DT_ACTIVE_CALL_SCREEN)
  1410.             {
  1411.                 main_LCD_dt_object.date.hide_function(x1, y1, x2, y2);
  1412.             }
  1413.             else
  1414.             {
  1415.                 main_LCD_dt_object.date.hide_function(0, y1, UI_device_width - 1, y2);
  1416.             }
  1417.             x1 = main_LCD_dt_object.time.x;
  1418.             y1 = main_LCD_dt_object.time.y;
  1419.             x2 = main_LCD_dt_object.time.width + x1 - 1;
  1420.             y2 = main_LCD_dt_object.time.height + y1 - 1;
  1421.             if (main_LCD_dt_object.flags & DT_FLAGS_TYPE == DT_ACTIVE_CALL_SCREEN)
  1422.             {
  1423.                 main_LCD_dt_object.time.hide_function(x1, y1, x2, y2);
  1424.             }
  1425.             else
  1426.             {
  1427.                 main_LCD_dt_object.time.hide_function(0, y1, UI_device_width - 1, y2);
  1428.             }
  1429.             if (!(FALSE == GetCallTimeDisplay()))
  1430.             {
  1431.                 x1 = main_LCD_dt_object.duration.x;
  1432.                 y1 = main_LCD_dt_object.duration.y;
  1433.                 x2 = main_LCD_dt_object.duration.width + x1 - 1;
  1434.                 y2 = main_LCD_dt_object.duration.height + y1 - 1;
  1435.                 if (main_LCD_dt_object.flags & DT_FLAGS_TYPE == DT_ACTIVE_CALL_SCREEN)
  1436.                 {
  1437.                     main_LCD_dt_object.duration.hide_function(x1, y1, x2, y2);
  1438.                 }
  1439.                 else
  1440.                 {
  1441.                     main_LCD_dt_object.duration.hide_function(0, y1, UI_device_width - 1, y2);
  1442.                 }
  1443.             }
  1444.         }
  1445.             break;
  1446.         case DT_DIGITAL_CLOCK_SC1:
  1447.         case DT_DIGITAL_CLOCK_SC2:
  1448.         case DT_DIGITAL_CLOCK_SC3:
  1449.         {
  1450.             x1 = main_LCD_dt_object.date.x;
  1451.             y1 = main_LCD_dt_object.date.y;
  1452.             x2 = main_LCD_dt_object.date.width + x1 - 1;
  1453.             y2 = main_LCD_dt_object.date.height + y1 - 1;
  1454.             main_LCD_dt_object.date.hide_function(x1, y1, x2, y2);
  1455.             x1 = main_LCD_dt_object.time.x;
  1456.             y1 = main_LCD_dt_object.time.y;
  1457.             x2 = main_LCD_dt_object.time.width + x1 - 1;
  1458.             y2 = main_LCD_dt_object.time.height + y1 - 1;
  1459.             main_LCD_dt_object.time.hide_function(x1, y1, x2, y2);
  1460.         }
  1461.             break;
  1462.     #ifdef __MMI_ANALOG_CLOCK__
  1463.         case DT_ANALOG_CLOCK_SC:
  1464.         {
  1465.             x1 = main_LCD_dt_object.time.x;
  1466.             y1 = main_LCD_dt_object.time.y;
  1467.             x2 = main_LCD_dt_object.time.width + x1 - 1;
  1468.             y2 = main_LCD_dt_object.time.height + y1 - 1;
  1469.             main_LCD_dt_object.time.hide_function(x1, y1, x2, y2);
  1470.         }
  1471.             break;
  1472.     #endif /* __MMI_ANALOG_CLOCK__ */ 
  1473.     }
  1474.     if (saved_graphics_context == &main_LCD_device_bitmap)
  1475.     {
  1476.         UI_set_main_LCD_graphics_context();
  1477.     }
  1478.     else if (saved_graphics_context == &sub_LCD_device_bitmap)
  1479.     {
  1480.         UI_set_sub_LCD_graphics_context();
  1481.     }
  1482. }
  1483. /*****************************************************************************
  1484.  * FUNCTION
  1485.  *  update_main_LCD_date_time
  1486.  * DESCRIPTION
  1487.  *  update main lcd date time
  1488.  * PARAMETERS
  1489.  *  void
  1490.  * RETURNS
  1491.  *  void
  1492.  *****************************************************************************/
  1493. void update_main_LCD_date_time(void)
  1494. {
  1495.     /*----------------------------------------------------------------*/
  1496.     /* Local Variables                                                */
  1497.     /*----------------------------------------------------------------*/
  1498.     /*----------------------------------------------------------------*/
  1499.     /* Code Body                                                      */
  1500.     /*----------------------------------------------------------------*/
  1501.     GetDateTime(&main_LCD_dt_object.date.t);
  1502.     main_LCD_dt_object.time.t = main_LCD_dt_object.date.t;
  1503. #ifdef __MMI_UI_TECHNO_IDLESCREEN_BAR__
  1504.     set_day_display();
  1505. #endif 
  1506. }
  1507. /*****************************************************************************
  1508.  * FUNCTION
  1509.  *  set_dt_duration
  1510.  * DESCRIPTION
  1511.  *  set the call duration of category17
  1512.  * PARAMETERS
  1513.  *  t       [IN]        
  1514.  * RETURNS
  1515.  *  void
  1516.  *****************************************************************************/
  1517. void set_dt_duration(UI_time *t)
  1518. {
  1519.     /*----------------------------------------------------------------*/
  1520.     /* Local Variables                                                */
  1521.     /*----------------------------------------------------------------*/
  1522.     /*----------------------------------------------------------------*/
  1523.     /* Code Body                                                      */
  1524.     /*----------------------------------------------------------------*/
  1525.     main_LCD_dt_object.duration.t = *t; /* set the duration value */
  1526.     DTGetRTCTime(&last_duration_time);
  1527. }
  1528. #ifdef __MMI_SUBLCD__
  1529. /*****************************************************************************
  1530.  * FUNCTION
  1531.  *  show_sub_LCD_date_time1
  1532.  * DESCRIPTION
  1533.  *  show sub lcd date time when ther is one city set
  1534.  * PARAMETERS
  1535.  *  void
  1536.  * RETURNS
  1537.  *  void
  1538.  *****************************************************************************/
  1539. void show_sub_LCD_date_time1(void)
  1540. {
  1541.     /*----------------------------------------------------------------*/
  1542.     /* Local Variables                                                */
  1543.     /*----------------------------------------------------------------*/
  1544.     bitmap *saved_graphics_context = current_LCD_device_bitmap;
  1545.     dm_coordinates coordinates;
  1546. #if defined(__MMI_SUBLCD_SHOW_DATE__) || defined(__MMI_SUBLCD_SHOW_TIME__)
  1547.     S32 h, w, x, y;
  1548.     UI_character_type s[64];
  1549.     S32 x1, y1, x2, y2;
  1550.     /*----------------------------------------------------------------*/
  1551.     /* Code Body                                                      */
  1552.     /*----------------------------------------------------------------*/
  1553.     y = 16; /* magic number by Pixtel */
  1554. #endif /* defined(__MMI_SUBLCD_SHOW_DATE__) || defined(__MMI_SUBLCD_SHOW_TIME__) */ 
  1555.     if (sub_lcd_update_date_time == MMI_FALSE)
  1556.     {
  1557.         return;
  1558.     }
  1559.     if (enable_sub_LCD_date_time_display)
  1560.     {
  1561.         GDI_LOCK;
  1562.         UI_set_sub_LCD_graphics_context();  /* change graphic context to sub lcd */
  1563.     #ifdef __MMI_SUB_WALLPAPER__
  1564.         if (sublcd_base_layer != GDI_ERROR_HANDLE)
  1565.         {
  1566.             gdi_layer_push_and_set_active(sublcd_base_layer);
  1567.         }
  1568.     #endif /* __MMI_SUB_WALLPAPER__ */ 
  1569.     }
  1570. #ifdef __MMI_SUBLCD_SHOW_DATE__
  1571.     gui_set_font(sub_LCD_dt_object1.date.font);
  1572.     /* get current date in string format */
  1573.     date_string(&sub_LCD_dt_object1.date.t, (UI_string_type) s, sub_LCD_dt_object1.flags);
  1574.     gui_measure_string(s, &w, &h);
  1575.     x = (UI_device_width >> 1) - (w >> 1);
  1576.     x1 = sub_LCD_dt_object1.date.x = x;
  1577.     y1 = sub_LCD_dt_object1.date.y = y;
  1578.     sub_LCD_dt_object1.date.width = w;
  1579.     sub_LCD_dt_object1.date.height = h - 2;
  1580.     if (enable_sub_LCD_date_time_display)
  1581.     {
  1582.         gui_set_text_color(sub_LCD_dt_object1.date.text_color);
  1583.         if (r2lMMIFlag)
  1584.         {
  1585.             gui_move_text_cursor(x + sub_LCD_dt_object1.date.width, y);
  1586.         }
  1587.         else
  1588.         {
  1589.             gui_move_text_cursor(x, y);
  1590.         }
  1591.         x2 = x1 + sub_LCD_dt_object1.date.width - 1;
  1592.         y2 = y1 + sub_LCD_dt_object1.date.height - 1;
  1593.         gui_set_text_clip(x1, y1, x2, y2);
  1594.         /* print date */
  1595.         gui_print_text(s);
  1596.         gdi_layer_blt_previous(x1, y1, x2, y2);
  1597.     }
  1598.     coordinates.s16X = sub_LCD_dt_object1.date.x;
  1599.     coordinates.s16Y = sub_LCD_dt_object1.date.y;
  1600.     coordinates.s16Width = sub_LCD_dt_object1.date.width;
  1601.     coordinates.s16Height = sub_LCD_dt_object1.date.height;
  1602.     y = y + h;
  1603. #endif /* __MMI_SUBLCD_SHOW_DATE__ */ 
  1604. #ifdef __MMI_SUBLCD_SHOW_TIME__
  1605.     gui_set_font(sub_LCD_dt_object1.time.font);
  1606.     /* get current time instring format */
  1607.     time_string(&sub_LCD_dt_object1.time.t, (UI_string_type) s, sub_LCD_dt_object1.flags);
  1608.     gui_measure_string(s, &w, &h);
  1609.     x = (UI_device_width >> 1) - (w >> 1);
  1610. #ifdef __MMI_SUBLCD_SHOW_WORLD_CLOCK__
  1611.     y = y + 14;
  1612. #endif 
  1613.     x1 = sub_LCD_dt_object1.time.x = x;
  1614.     y1 = sub_LCD_dt_object1.time.y = y;
  1615.     sub_LCD_dt_object1.time.width = w;
  1616.     sub_LCD_dt_object1.time.height = h;
  1617.     if (enable_sub_LCD_date_time_display)
  1618.     {
  1619.         gui_set_text_color(sub_LCD_dt_object1.time.text_color);
  1620.         gui_set_text_border_color(sub_LCD_dt_object1.time.text_border_color);
  1621.         if (r2lMMIFlag)
  1622.         {
  1623.             gui_move_text_cursor(x + sub_LCD_dt_object1.time.width, y);
  1624.         }
  1625.         else
  1626.         {
  1627.             gui_move_text_cursor(x, y);
  1628.         }
  1629.         x2 = x1 + sub_LCD_dt_object1.time.width - 1;
  1630.         y2 = y1 + sub_LCD_dt_object1.time.height - 1;
  1631.         gui_set_text_clip(x1, y1, x2, y2);
  1632.         /* print time */
  1633.         gui_print_text(s);
  1634.         gdi_layer_blt_previous(x1, y1, x2, y2);
  1635.     }
  1636.     coordinates.s16X = sub_LCD_dt_object1.time.x;
  1637.     coordinates.s16Y = sub_LCD_dt_object1.time.y;
  1638.     coordinates.s16Width = sub_LCD_dt_object1.time.width;
  1639.     coordinates.s16Height = sub_LCD_dt_object1.time.height;
  1640. #ifndef __MMI_SUBLCD_SHOW_ONE_CITY__
  1641.     gui_set_font(sub_LCD_dt_object2.time.font);
  1642.     time_string(&sub_LCD_dt_object2.time.t, (UI_string_type) s, sub_LCD_dt_object2.flags);
  1643.     gui_measure_string(s, &w, &h);
  1644.     x = (UI_device_width >> 1) - (w >> 1);
  1645.     y = UI_device_height - h;
  1646.     x1 = sub_LCD_dt_object2.time.x = x;
  1647.     y1 = sub_LCD_dt_object2.time.y = y;
  1648.     sub_LCD_dt_object2.time.width = w;
  1649.     sub_LCD_dt_object2.time.height = h;
  1650.     if (enable_sub_LCD_date_time_display)
  1651.     {
  1652.         gui_set_text_color(sub_LCD_dt_object2.time.text_color);
  1653.         gui_set_text_border_color(sub_LCD_dt_object2.time.text_border_color);
  1654.         if (r2lMMIFlag)
  1655.         {
  1656.             gui_move_text_cursor(x + sub_LCD_dt_object2.time.width, y);
  1657.         }
  1658.         else
  1659.         {
  1660.             gui_move_text_cursor(x, y);
  1661.         }
  1662.         x2 = x1 + sub_LCD_dt_object2.time.width - 1;
  1663.         y2 = y1 + sub_LCD_dt_object2.time.height - 1;
  1664.         gui_set_text_clip(x1, y1, x2, y2);
  1665.         gui_print_text(s);
  1666.         gdi_layer_blt_previous(x1, y1, x2, y2);
  1667.     }
  1668.     coordinates.s16X = sub_LCD_dt_object2.time.x;
  1669.     coordinates.s16Y = sub_LCD_dt_object2.time.y;
  1670.     coordinates.s16Width = sub_LCD_dt_object2.time.width;
  1671.     coordinates.s16Height = sub_LCD_dt_object2.time.height;
  1672. #endif /* __MMI_SUBLCD_SHOW_ONE_CITY__ */ 
  1673. #endif /* __MMI_SUBLCD_SHOW_TIME__ */ 
  1674.     setup_previous_control(&coordinates);
  1675.     if (enable_sub_LCD_date_time_display)
  1676.     {
  1677.         if (saved_graphics_context == &main_LCD_device_bitmap)
  1678.         {
  1679.             UI_set_main_LCD_graphics_context();
  1680.         }
  1681.         else if (saved_graphics_context == &sub_LCD_device_bitmap)
  1682.         {
  1683.             UI_set_sub_LCD_graphics_context();
  1684.         }
  1685.         GDI_UNLOCK;
  1686.     #ifdef __MMI_SUB_WALLPAPER__
  1687.         if (sublcd_base_layer != GDI_ERROR_HANDLE)
  1688.         {
  1689.             gdi_layer_pop_and_restore_active();
  1690.         }
  1691.     #endif /* __MMI_SUB_WALLPAPER__ */ 
  1692.     }
  1693. }
  1694. /*****************************************************************************
  1695.  * FUNCTION
  1696.  *  hide_sub_LCD_date_time1
  1697.  * DESCRIPTION
  1698.  *  hide function of date time of sub lcd when only 1 city is set
  1699.  * PARAMETERS
  1700.  *  void
  1701.  * RETURNS
  1702.  *  void
  1703.  *****************************************************************************/
  1704. void hide_sub_LCD_date_time1(void)
  1705. {
  1706.     /*----------------------------------------------------------------*/
  1707.     /* Local Variables                                                */
  1708.     /*----------------------------------------------------------------*/
  1709.     S32 x1, y1, x2, y2;
  1710.     bitmap *saved_graphics_context = current_LCD_device_bitmap;
  1711.     /*----------------------------------------------------------------*/
  1712.     /* Code Body                                                      */
  1713.     /*----------------------------------------------------------------*/
  1714.     if (sub_lcd_update_date_time == MMI_FALSE)
  1715.     {
  1716.         return;
  1717.     }
  1718.     GDI_LOCK;
  1719.     UI_set_sub_LCD_graphics_context();
  1720. #ifdef __MMI_SUBLCD_SHOW_DATE__
  1721.     x1 = sub_LCD_dt_object1.date.x;
  1722.     y1 = sub_LCD_dt_object1.date.y;
  1723.     x2 = sub_LCD_dt_object1.date.width + x1 - 1;
  1724.     y2 = sub_LCD_dt_object1.date.height + y1 - 1;
  1725.     sub_LCD_dt_object1.date.hide_function(x1, y1, x2, y2);
  1726. #endif /* __MMI_SUBLCD_SHOW_DATE__ */ 
  1727.     x1 = sub_LCD_dt_object1.time.x;
  1728.     y1 = sub_LCD_dt_object1.time.y;
  1729.     x2 = sub_LCD_dt_object1.time.width + x1 - 1;
  1730.     y2 = sub_LCD_dt_object1.time.height + y1 - 1;
  1731.     sub_LCD_dt_object1.time.hide_function(x1, y1, x2, y2);
  1732. #ifndef __MMI_SUBLCD_SHOW_ONE_CITY__
  1733.     x1 = sub_LCD_dt_object2.time.x;
  1734.     y1 = sub_LCD_dt_object2.time.y;
  1735.     x2 = sub_LCD_dt_object2.time.width + x1 - 1;
  1736.     y2 = sub_LCD_dt_object2.time.height + y1 - 1;
  1737.     sub_LCD_dt_object2.time.hide_function(x1, y1, x2, y2);
  1738. #endif /* __MMI_SUBLCD_SHOW_ONE_CITY__ */ 
  1739.     if (saved_graphics_context == &main_LCD_device_bitmap)
  1740.     {
  1741.         UI_set_main_LCD_graphics_context();
  1742.     }
  1743.     else if (saved_graphics_context == &sub_LCD_device_bitmap)
  1744.     {
  1745.         UI_set_sub_LCD_graphics_context();
  1746.     }
  1747.     GDI_UNLOCK;
  1748. }
  1749. /*****************************************************************************
  1750.  * FUNCTION
  1751.  *  update_sub_LCD_date_time1
  1752.  * DESCRIPTION
  1753.  *  get current date time and update date time on sublcd
  1754.  *  when one sub lcd city is set
  1755.  * PARAMETERS
  1756.  *  void
  1757.  * RETURNS
  1758.  *  void
  1759.  *****************************************************************************/
  1760. void update_sub_LCD_date_time1(void)
  1761. {
  1762.     /*----------------------------------------------------------------*/
  1763.     /* Local Variables                                                */
  1764.     /*----------------------------------------------------------------*/
  1765.     /*----------------------------------------------------------------*/
  1766.     /* Code Body                                                      */
  1767.     /*----------------------------------------------------------------*/
  1768.     GDI_LOCK;
  1769.     GetDateTime(&sub_LCD_dt_object1.date.t);
  1770.     sub_LCD_dt_object2.date.t = sub_LCD_dt_object1.date.t;
  1771.     get_time_difference(&sub_LCD_dt_object1.date.t, dt_difference1);    /* get tiem diff of city1 with current time */
  1772.     sub_LCD_dt_object1.time.t = sub_LCD_dt_object1.date.t;
  1773. #ifndef __MMI_SUBLCD_SHOW_ONE_CITY__
  1774.     get_time_difference(&sub_LCD_dt_object2.date.t, dt_difference2);    /* get tiem diff of city2 with current time */
  1775.     sub_LCD_dt_object2.time.t = sub_LCD_dt_object2.date.t;
  1776. #endif /* __MMI_SUBLCD_SHOW_ONE_CITY__ */ 
  1777.     GDI_UNLOCK;
  1778. }
  1779. /*****************************************************************************
  1780.  * FUNCTION
  1781.  *  show_sub_LCD_date_time2
  1782.  * DESCRIPTION
  1783.  *  show sub lcd date tiem of 2 cities
  1784.  * PARAMETERS
  1785.  *  void
  1786.  * RETURNS
  1787.  *  void
  1788.  *****************************************************************************/
  1789. void show_sub_LCD_date_time2(void)
  1790. {
  1791.     /*----------------------------------------------------------------*/
  1792.     /* Local Variables                                                */
  1793.     /*----------------------------------------------------------------*/
  1794.     bitmap *saved_graphics_context = current_LCD_device_bitmap;
  1795.     dm_coordinates coordinates;
  1796. #if defined(__MMI_SUBLCD_SHOW_DATE__) || defined(__MMI_SUBLCD_SHOW_TIME__)
  1797.     S32 x1, x2, y1, y2;
  1798.     S32 gap;
  1799. #endif /* defined(__MMI_SUBLCD_SHOW_DATE__) || defined(__MMI_SUBLCD_SHOW_TIME__) */ 
  1800. #if defined(__MMI_SUBLCD_SHOW_DATE__)
  1801.     S32 date_height, date_width;
  1802.     UI_character_type date[32];
  1803. #endif /* defined(__MMI_SUBLCD_SHOW_DATE__) */ 
  1804. #if defined(__MMI_SUBLCD_SHOW_TIME__)
  1805.     S32 time_height, time_width;
  1806.     UI_character_type time[32];
  1807. #endif /* defined(__MMI_SUBLCD_SHOW_TIME__) */ 
  1808.     /*----------------------------------------------------------------*/
  1809.     /* Code Body                                                      */
  1810.     /*----------------------------------------------------------------*/
  1811.     if (sub_lcd_update_date_time == MMI_FALSE)
  1812.     {
  1813.         return;
  1814.     }
  1815.     if (enable_sub_LCD_date_time_display)
  1816.     {
  1817.         GDI_LOCK;
  1818.         UI_set_sub_LCD_graphics_context();
  1819.     #ifdef __MMI_SUB_WALLPAPER__
  1820.         if (sublcd_base_layer != GDI_ERROR_HANDLE)
  1821.         {
  1822.             gdi_layer_push_and_set_active(sublcd_base_layer);
  1823.         }
  1824.     #endif /* __MMI_SUB_WALLPAPER__ */ 
  1825.     }
  1826. #if defined (__MMI_SUBLCD_SHOW_DATE__) && defined (__MMI_SUBLCD_SHOW_TIME__)
  1827.     gui_set_font(sub_LCD_dt_object1.date.font);
  1828.     date_string(&sub_LCD_dt_object1.date.t, (UI_string_type) date, sub_LCD_dt_object1.flags);
  1829.     gui_measure_string((UI_string_type) date, &date_width, &date_height);
  1830. #ifdef __MMI_SUB_WALLPAPER__
  1831.     date_width += 2;    /* 2 is for border size. */
  1832.     date_height += 2;   /* 2 is for border size. */
  1833. #endif /* __MMI_SUB_WALLPAPER__ */ 
  1834.     gui_set_font(sub_LCD_dt_object1.time.font);
  1835.     time_string(&sub_LCD_dt_object1.time.t, (UI_string_type) time, sub_LCD_dt_object1.flags);
  1836.     gui_measure_string((UI_string_type) time, &time_width, &time_height);
  1837.     time_width += 2;    /* 2 is for border size. */
  1838.     time_height += 2;   /* 2 is for border size. */
  1839.     gap = (UI_device_height - Sub_lcd_title_height - date_height - time_height) / 3;
  1840.     if (sublcd_date_time_display_type == SUBLCD_DT_DATE_THEN_TIME_TYPE1)
  1841.     {
  1842.         sub_LCD_dt_object1.date.y = UI_device_height - (gap << 1) - date_height - time_height - 1;
  1843.         sub_LCD_dt_object1.time.y = UI_device_height - gap - time_height - 1;
  1844.     }
  1845.     else if (sublcd_date_time_display_type == SUBLCD_DT_TIME_THEN_DATE_TYPE1)
  1846.     {
  1847.         sub_LCD_dt_object1.time.y = UI_device_height - (gap << 1) - date_height - time_height - 1;
  1848.         sub_LCD_dt_object1.date.y = UI_device_height - gap - date_height - 1;
  1849.     }
  1850. #elif defined (__MMI_SUBLCD_SHOW_DATE__)
  1851.     gui_set_font(sub_LCD_dt_object1.date.font);
  1852.     date_string(&sub_LCD_dt_object1.date.t, (UI_string_type) date, sub_LCD_dt_object1.flags);
  1853.     gui_measure_string((UI_string_type) date, &date_width, &date_height);
  1854. #ifdef __MMI_SUB_WALLPAPER__
  1855.     date_width += 2;    /* 2 is for border size. */
  1856.     date_height += 2;   /* 2 is for border size. */
  1857. #endif /* __MMI_SUB_WALLPAPER__ */ 
  1858.     gap = (UI_device_height - Sub_lcd_title_height - date_height) >> 1;
  1859.     sub_LCD_dt_object1.date.y = UI_device_height - gap - date_height - 1;
  1860. #elif defined (__MMI_SUBLCD_SHOW_TIME__)
  1861.     gui_set_font(sub_LCD_dt_object1.time.font);
  1862.     time_string(&sub_LCD_dt_object1.time.t, (UI_string_type) time, sub_LCD_dt_object1.flags);
  1863.     gui_measure_string((UI_string_type) time, &time_width, &time_height);
  1864.     time_width += 2;    /* 2 is for border size. */
  1865.     time_height += 2;   /* 2 is for border size. */
  1866.     gap = (UI_device_height - Sub_lcd_title_height - time_height) >> 1;
  1867.     sub_LCD_dt_object1.time.y = UI_device_height - gap - time_height - 1;
  1868. #endif 
  1869. #ifdef __MMI_SUBLCD_SHOW_DATE__
  1870.     x1 = sub_LCD_dt_object1.date.x = (UI_device_width - date_width) >> 1;
  1871.     y1 = sub_LCD_dt_object1.date.y;
  1872.     sub_LCD_dt_object1.date.width = date_width;
  1873.     sub_LCD_dt_object1.date.height = date_height;
  1874.     x2 = x1 + date_width - 1;
  1875.     y2 = y1 + date_height - 1;
  1876.     if (enable_sub_LCD_date_time_display)
  1877.     {
  1878.         gui_set_text_color(sub_LCD_dt_object1.date.text_color);
  1879.         gui_set_text_border_color(sub_LCD_dt_object1.date.text_border_color);
  1880.         if (r2lMMIFlag)
  1881.         {
  1882.             gui_move_text_cursor(x1 + date_width, y1 + 1);  /* for border */
  1883.         }
  1884.         else
  1885.         {
  1886.             gui_move_text_cursor(x1, y1 + 1);   /* for border */
  1887.         }
  1888.         gui_set_text_clip(x1, y1, x2, y2);
  1889.         /* print date */
  1890.         gui_set_font(sub_LCD_dt_object1.date.font);
  1891.     #ifdef __MMI_SUB_WALLPAPER__
  1892.         gui_print_bordered_text(date);
  1893.     #else 
  1894.         gui_print_text(date);
  1895.     #endif 
  1896.         gdi_layer_blt_previous(0, y1, UI_device_width - 1, y2);
  1897.     }
  1898.     coordinates.s16X = sub_LCD_dt_object1.date.x;
  1899.     coordinates.s16Y = sub_LCD_dt_object1.date.y;
  1900.     coordinates.s16Width = sub_LCD_dt_object1.date.width;
  1901.     coordinates.s16Height = sub_LCD_dt_object1.date.height;
  1902. #endif /* __MMI_SUBLCD_SHOW_DATE__ */ 
  1903. #ifdef __MMI_SUBLCD_SHOW_TIME__
  1904.     x1 = sub_LCD_dt_object1.time.x = (UI_device_width - time_width) >> 1;
  1905.     y1 = sub_LCD_dt_object1.time.y;
  1906.     sub_LCD_dt_object1.time.width = time_width;
  1907.     sub_LCD_dt_object1.time.height = time_height;
  1908.     x2 = x1 + time_width - 1;
  1909.     y2 = y1 + time_height - 1;
  1910.     if (enable_sub_LCD_date_time_display)
  1911.     {
  1912.         gui_set_text_color(sub_LCD_dt_object1.time.text_color);
  1913.         gui_set_text_border_color(sub_LCD_dt_object1.time.text_border_color);
  1914.         if (r2lMMIFlag)
  1915.         {
  1916.             gui_move_text_cursor(x1 + time_width, y1 + 1);  /* for border */
  1917.         }
  1918.         else
  1919.         {
  1920.             gui_move_text_cursor(x1, y1 + 1);   /* for border */
  1921.         }
  1922.         gui_set_text_clip(x1, y1, x2, y2);
  1923.         /* print time */
  1924.         gui_set_font(sub_LCD_dt_object1.time.font);
  1925.     #ifdef __MMI_SUB_WALLPAPER__
  1926.         gui_print_bordered_text(time);
  1927.     #else 
  1928.         gui_print_text(time);
  1929.     #endif 
  1930.         gdi_layer_blt_previous(0, y1, UI_device_width - 1, y2);
  1931.     }
  1932.     coordinates.s16X = sub_LCD_dt_object1.time.x;
  1933.     coordinates.s16Y = sub_LCD_dt_object1.time.y;
  1934.     coordinates.s16Width = sub_LCD_dt_object1.time.width;
  1935.     coordinates.s16Height = sub_LCD_dt_object1.time.height;
  1936. #endif /* __MMI_SUBLCD_SHOW_TIME__ */ 
  1937.     setup_previous_control(&coordinates);
  1938.     if (enable_sub_LCD_date_time_display)
  1939.     {
  1940.     #ifdef __MMI_SUB_WALLPAPER__
  1941.         gdi_layer_pop_and_restore_active();
  1942.     #endif 
  1943.         if (saved_graphics_context == &main_LCD_device_bitmap)
  1944.         {
  1945.             UI_set_main_LCD_graphics_context();
  1946.         }
  1947.         else if (saved_graphics_context == &sub_LCD_device_bitmap)
  1948.         {
  1949.             UI_set_sub_LCD_graphics_context();
  1950.         }
  1951.         GDI_UNLOCK;
  1952.     }
  1953. }
  1954. /*****************************************************************************
  1955.  * FUNCTION
  1956.  *  hide_sub_LCD_date_time2
  1957.  * DESCRIPTION
  1958.  *  hide function of date tiem of sub lcd when 2 cities is set
  1959.  * PARAMETERS
  1960.  *  void
  1961.  * RETURNS
  1962.  *  void
  1963.  *****************************************************************************/
  1964. void hide_sub_LCD_date_time2(void)
  1965. {
  1966.     /*----------------------------------------------------------------*/
  1967.     /* Local Variables                                                */
  1968.     /*----------------------------------------------------------------*/
  1969.     S32 x1 = 0, y1 = 0, x2 = 0, y2 = 0;
  1970.     bitmap *saved_graphics_context = current_LCD_device_bitmap;
  1971.     /*----------------------------------------------------------------*/
  1972.     /* Code Body                                                      */
  1973.     /*----------------------------------------------------------------*/
  1974.     if (sub_lcd_update_date_time == MMI_FALSE)
  1975.     {
  1976.         return;
  1977.     }
  1978.     GDI_LOCK;
  1979.     UI_set_sub_LCD_graphics_context();
  1980. #if (defined  __MMI_SUBLCD_SHOW_DATE__) && (defined __MMI_SUBLCD_SHOW_TIME__)
  1981.     x1 = sub_LCD_dt_object1.date.x;
  1982.     x2 = sub_LCD_dt_object1.date.width + x1 - 1;
  1983.     if (sublcd_date_time_display_type == SUBLCD_DT_DATE_THEN_TIME_TYPE1)
  1984.     {
  1985.         y1 = sub_LCD_dt_object1.date.y;
  1986.         y2 = sub_LCD_dt_object1.time.height + sub_LCD_dt_object1.time.y - 1;
  1987.     }
  1988.     else if (sublcd_date_time_display_type == SUBLCD_DT_TIME_THEN_DATE_TYPE1)
  1989.     {
  1990.         y1 = sub_LCD_dt_object1.time.y;
  1991.         y2 = sub_LCD_dt_object1.date.height + sub_LCD_dt_object1.date.y - 1;
  1992.     }
  1993.     if (x1 > sub_LCD_dt_object1.time.x)
  1994.     {
  1995.         x1 = sub_LCD_dt_object1.time.x;
  1996.     }
  1997.     if (x2 < sub_LCD_dt_object1.time.width + sub_LCD_dt_object1.time.x - 1)
  1998.     {
  1999.         x2 = sub_LCD_dt_object1.time.width + sub_LCD_dt_object1.time.x - 1;
  2000.     }
  2001.     sub_LCD_dt_object1.time.hide_function(x1, y1, x2, y2);  /* call hide function of time sub lcd */
  2002. #elif defined (__MMI_SUBLCD_SHOW_DATE__)
  2003.     x1 = sub_LCD_dt_object1.date.x;
  2004.     y1 = sub_LCD_dt_object1.date.y;
  2005.     x2 = sub_LCD_dt_object1.date.width + x1 - 1;
  2006.     y2 = sub_LCD_dt_object1.date.height + y1 - 1;
  2007.     sub_LCD_dt_object1.time.hide_function(x1, y1, x2, y2);  /* call hide func of date sub lcd */
  2008. #elif defined (__MMI_SUBLCD_SHOW_TIME__)
  2009.     x1 = sub_LCD_dt_object1.time.x;
  2010.     y1 = sub_LCD_dt_object1.time.y;
  2011.     x2 = sub_LCD_dt_object1.time.width + x1 - 1;
  2012.     y2 = sub_LCD_dt_object1.time.height + y1 - 1;
  2013.     sub_LCD_dt_object1.time.hide_function(x1, y1, x2, y2);  /* call hide function of time sub lcd */
  2014. #endif 
  2015.     if (saved_graphics_context == &main_LCD_device_bitmap)
  2016.     {
  2017.         UI_set_main_LCD_graphics_context();
  2018.     }
  2019.     else if (saved_graphics_context == &sub_LCD_device_bitmap)
  2020.     {
  2021.         UI_set_sub_LCD_graphics_context();
  2022.     }
  2023.     GDI_UNLOCK;
  2024. }
  2025. /*****************************************************************************
  2026.  * FUNCTION
  2027.  *  update_sub_LCD_date_time2
  2028.  * DESCRIPTION
  2029.  *  upadet date tiem of sub lcd
  2030.  * PARAMETERS
  2031.  *  void
  2032.  * RETURNS
  2033.  *  void
  2034.  *****************************************************************************/
  2035. void update_sub_LCD_date_time2(void)
  2036. {
  2037.     /*----------------------------------------------------------------*/
  2038.     /* Local Variables                                                */
  2039.     /*----------------------------------------------------------------*/
  2040.     /*----------------------------------------------------------------*/
  2041.     /* Code Body                                                      */
  2042.     /*----------------------------------------------------------------*/
  2043.     GDI_LOCK;
  2044.     GetDateTime(&sub_LCD_dt_object1.date.t);    /* get current date time */
  2045.     get_time_difference(&sub_LCD_dt_object1.date.t, dt_difference1);    /* get time diff between city1 and and current time */
  2046.     sub_LCD_dt_object1.time.t = sub_LCD_dt_object1.date.t;
  2047.     GDI_UNLOCK;
  2048. }
  2049. #endif /* __MMI_SUBLCD__ */ 
  2050. /*----------------------------------------------------------------------------
  2051. Function:         MMI_main_LCD_dt_date_hide_function
  2052. Description:      date hide funtion pointer of main lcd
  2053. Input Parameters: S32 x1   start x position
  2054.                S32 y1   start y position
  2055.                S32 x2   end x position
  2056.                S32 y2   end y position
  2057. Output Parameters:   none
  2058. Returns:       none
  2059. ----------------------------------------------------------------------------*/
  2060. void (*MMI_main_LCD_dt_date_hide_function) (S32 x1, S32 y1, S32 x2, S32 y2) = UI_dummy_hide_function;
  2061. /*----------------------------------------------------------------------------
  2062. Function:         MMI_main_LCD_dt_time_hide_function
  2063. Description:      time hide funtion pointer of main lcd
  2064. Input Parameters: S32 x1   start x position
  2065.                S32 y1   start y position
  2066.                S32 x2   end x position
  2067.                S32 y2   end y position
  2068. Output Parameters:   none
  2069. Returns:       none
  2070. ----------------------------------------------------------------------------*/
  2071. void (*MMI_main_LCD_dt_time_hide_function) (S32 x1, S32 y1, S32 x2, S32 y2) = UI_dummy_hide_function;
  2072. /*----------------------------------------------------------------------------
  2073. Function:         MMI_main_LCD_dt_duration_hide_function
  2074. Description:      call time  duration  hide funtion pointer of main lcd
  2075. Input Parameters: S32 x1   start x position
  2076.                S32 y1   start y position
  2077.                S32 x2   end x position
  2078.                S32 y2   end y position
  2079. Output Parameters:   none
  2080. Returns:       none
  2081. ----------------------------------------------------------------------------*/
  2082. void (*MMI_main_LCD_dt_duration_hide_function) (S32 x1, S32 y1, S32 x2, S32 y2) = UI_dummy_hide_function;
  2083. /*----------------------------------------------------------------------------
  2084. Function:         MMI_sub_LCD_dt_date_hide_function
  2085. Description:      date  hide funtion pointer of sub  lcd
  2086. Input Parameters: S32 x1   start x position
  2087.                S32 y1   start y position
  2088.                S32 x2   end x position
  2089.                S32 y2   end y position
  2090. Output Parameters:   none
  2091. Returns:       none
  2092. ----------------------------------------------------------------------------*/
  2093. void (*MMI_sub_LCD_dt_date_hide_function) (S32 x1, S32 y1, S32 x2, S32 y2) = UI_dummy_hide_function;
  2094. /*----------------------------------------------------------------------------
  2095. Function:         MMI_sub_LCD_dt_time_hide_function
  2096. Description:      time  hide funtion pointer of sub  lcd
  2097. Input Parameters: S32 x1   start x position
  2098.                S32 y1   start y position
  2099.                S32 x2   end x position
  2100.                S32 y2   end y position
  2101. Output Parameters:   none
  2102. Returns:       none
  2103. ----------------------------------------------------------------------------*/
  2104. void (*MMI_sub_LCD_dt_time_hide_function) (S32 x1, S32 y1, S32 x2, S32 y2) = UI_dummy_hide_function;
  2105. /*----------------------------------------------------------------------------
  2106. Function:         MMI_sub_LCD_dt_duration_hide_function
  2107. Description:      call time duration   hide funtion pointer of sub  lcd
  2108. Input Parameters: S32 x1   start x position
  2109.                S32 y1   start y position
  2110.                S32 x2   end x position
  2111.                S32 y2   end y position
  2112. Output Parameters:   none
  2113. Returns:       none
  2114. ----------------------------------------------------------------------------*/
  2115. void (*MMI_sub_LCD_dt_duration_hide_function) (S32 x1, S32 y1, S32 x2, S32 y2) = UI_dummy_hide_function;
  2116. /*****************************************************************************
  2117.  * FUNCTION
  2118.  *  set_main_LCD_dt_date_hide_function
  2119.  * DESCRIPTION
  2120.  *  register date hide function of main lcd
  2121.  * PARAMETERS
  2122.  *  f               [IN]        
  2123.  *  function(?)     [IN]        Pointer
  2124.  * RETURNS
  2125.  *  void
  2126.  *****************************************************************************/
  2127. void set_main_LCD_dt_date_hide_function(void (*f) (S32 x1, S32 y1, S32 x2, S32 y2))
  2128. {
  2129.     /*----------------------------------------------------------------*/
  2130.     /* Local Variables                                                */
  2131.     /*----------------------------------------------------------------*/
  2132.     /*----------------------------------------------------------------*/
  2133.     /* Code Body                                                      */
  2134.     /*----------------------------------------------------------------*/
  2135.     MMI_main_LCD_dt_date_hide_function = f;
  2136. }
  2137. /*****************************************************************************
  2138.  * FUNCTION
  2139.  *  set_main_LCD_dt_time_hide_function
  2140.  * DESCRIPTION
  2141.  *  register time hide function of main lcd
  2142.  * PARAMETERS
  2143.  *  f               [IN]        
  2144.  *  function(?)     [IN]        Pointer
  2145.  * RETURNS
  2146.  *  void
  2147.  *****************************************************************************/
  2148. void set_main_LCD_dt_time_hide_function(void (*f) (S32 x1, S32 y1, S32 x2, S32 y2))
  2149. {
  2150.     /*----------------------------------------------------------------*/
  2151.     /* Local Variables                                                */
  2152.     /*----------------------------------------------------------------*/
  2153.     /*----------------------------------------------------------------*/
  2154.     /* Code Body                                                      */
  2155.     /*----------------------------------------------------------------*/
  2156.     MMI_main_LCD_dt_time_hide_function = f;
  2157. }
  2158. /*****************************************************************************
  2159.  * FUNCTION
  2160.  *  set_main_LCD_dt_duration_hide_function
  2161.  * DESCRIPTION
  2162.  *  register call time duration  hide function of main lcd
  2163.  * PARAMETERS
  2164.  *  f               [IN]        
  2165.  *  function(?)     [IN]        Pointer
  2166.  * RETURNS
  2167.  *  void
  2168.  *****************************************************************************/
  2169. void set_main_LCD_dt_duration_hide_function(void (*f) (S32 x1, S32 y1, S32 x2, S32 y2))
  2170. {
  2171.     /*----------------------------------------------------------------*/
  2172.     /* Local Variables                                                */
  2173.     /*----------------------------------------------------------------*/
  2174.     /*----------------------------------------------------------------*/
  2175.     /* Code Body                                                      */
  2176.     /*----------------------------------------------------------------*/
  2177.     MMI_main_LCD_dt_duration_hide_function = f;
  2178. }
  2179. /*****************************************************************************
  2180.  * FUNCTION
  2181.  *  set_sub_LCD_dt_date_hide_function
  2182.  * DESCRIPTION
  2183.  *  register date hide function of sub lcd
  2184.  * PARAMETERS
  2185.  *  f               [IN]        
  2186.  *  function(?)     [IN]        Pointer
  2187.  * RETURNS
  2188.  *  void
  2189.  *****************************************************************************/
  2190. void set_sub_LCD_dt_date_hide_function(void (*f) (S32 x1, S32 y1, S32 x2, S32 y2))
  2191. {
  2192.     /*----------------------------------------------------------------*/
  2193.     /* Local Variables                                                */
  2194.     /*----------------------------------------------------------------*/
  2195.     /*----------------------------------------------------------------*/
  2196.     /* Code Body                                                      */
  2197.     /*----------------------------------------------------------------*/
  2198.     MMI_sub_LCD_dt_date_hide_function = f;
  2199. }
  2200. /*****************************************************************************
  2201.  * FUNCTION
  2202.  *  set_sub_LCD_dt_time_hide_function
  2203.  * DESCRIPTION
  2204.  *  register time hide function of sub lcd
  2205.  * PARAMETERS
  2206.  *  f               [IN]        
  2207.  *  function(?)     [IN]        Pointer
  2208.  * RETURNS
  2209.  *  void
  2210.  *****************************************************************************/
  2211. void set_sub_LCD_dt_time_hide_function(void (*f) (S32 x1, S32 y1, S32 x2, S32 y2))
  2212. {
  2213.     /*----------------------------------------------------------------*/
  2214.     /* Local Variables                                                */
  2215.     /*----------------------------------------------------------------*/
  2216.     /*----------------------------------------------------------------*/
  2217.     /* Code Body                                                      */
  2218.     /*----------------------------------------------------------------*/
  2219.     MMI_sub_LCD_dt_time_hide_function = f;
  2220. }
  2221. /*****************************************************************************
  2222.  * FUNCTION
  2223.  *  set_sub_LCD_dt_duration_hide_function
  2224.  * DESCRIPTION
  2225.  *  register cal time duration  hide function of sub lcd
  2226.  * PARAMETERS
  2227.  *  f               [IN]        
  2228.  *  function(?)     [IN]        Pointer
  2229.  * RETURNS
  2230.  *  void
  2231.  *****************************************************************************/
  2232. void set_sub_LCD_dt_duration_hide_function(void (*f) (S32 x1, S32 y1, S32 x2, S32 y2))
  2233. {
  2234.     /*----------------------------------------------------------------*/
  2235.     /* Local Variables                                                */
  2236.     /*----------------------------------------------------------------*/
  2237.     /*----------------------------------------------------------------*/
  2238.     /* Code Body                                                      */
  2239.     /*----------------------------------------------------------------*/
  2240.     MMI_sub_LCD_dt_duration_hide_function = f;
  2241. }
  2242. /* PMT HIMANSHU START 20050721 */
  2243. #ifdef __MMI_UI_TECHNO_IDLESCREEN_BAR__
  2244. /*****************************************************************************
  2245.  * FUNCTION
  2246.  *  set_main_LCD_day_hide_function
  2247.  * DESCRIPTION
  2248.  *  register day hide function of Main LCD
  2249.  * PARAMETERS
  2250.  *  f               [IN]        
  2251.  *  function(?)     [IN]        Pointer
  2252.  * RETURNS
  2253.  *  void
  2254.  *****************************************************************************/
  2255. void set_main_LCD_day_hide_function(void (*f) (S32 x1, S32 y1, S32 x2, S32 y2))
  2256. {
  2257.     /*----------------------------------------------------------------*/
  2258.     /* Local Variables                                                */
  2259.     /*----------------------------------------------------------------*/
  2260.     /*----------------------------------------------------------------*/
  2261.     /* Code Body                                                      */
  2262.     /*----------------------------------------------------------------*/
  2263.     MMI_main_LCD_dt_day_hide_function = f;
  2264. }
  2265. #endif /* __MMI_UI_TECHNO_IDLESCREEN_BAR__ */ 
  2266. /* PMT HIMANSHU END 20050721 */
  2267. /*****************************************************************************
  2268.  * FUNCTION
  2269.  *  dt_show_duration
  2270.  * DESCRIPTION
  2271.  *  
  2272.  * PARAMETERS
  2273.  *  void
  2274.  * RETURNS
  2275.  *  void
  2276.  *****************************************************************************/
  2277. static void dt_show_duration(void)
  2278. {
  2279.     /*----------------------------------------------------------------*/
  2280.     /* Local Variables                                                */
  2281.     /*----------------------------------------------------------------*/
  2282.     UI_character_type s[64];
  2283.     S32 x1, y1, x2, y2;
  2284.     S32 w;
  2285.     /*----------------------------------------------------------------*/
  2286.     /* Code Body                                                      */
  2287.     /*----------------------------------------------------------------*/
  2288.     gdi_layer_lock_frame_buffer();
  2289.     x1 = main_LCD_dt_object.duration.x;
  2290.     y1 = main_LCD_dt_object.duration.y;
  2291.     x2 = main_LCD_dt_object.duration.width + x1 - 1;
  2292.     y2 = main_LCD_dt_object.duration.height + y1 - 1;
  2293.     main_LCD_dt_object.duration.hide_function(x1, y1, x2, y2);  /* call hide function of call duration */
  2294.     gui_set_font(main_LCD_dt_object.duration.font);
  2295.     /* get call duration in string fromat */
  2296.     duration_string(&main_LCD_dt_object.duration.t, (UI_string_type) s, main_LCD_dt_object.flags);
  2297.     gui_set_text_color(main_LCD_dt_object.duration.text_color);
  2298.     w = gui_get_string_width(s);
  2299.     if (r2lMMIFlag)
  2300.     {
  2301.         gui_move_text_cursor(x1 + w - 1, y1);
  2302.     }
  2303.     else
  2304.     {
  2305.         gui_move_text_cursor(x1, y1);
  2306.     }
  2307.     gui_set_text_clip(x1, y1, x2, y2);
  2308.     /* print call duration */
  2309.     gui_print_text(s);
  2310.     gdi_layer_unlock_frame_buffer();
  2311.     gdi_layer_blt_previous(x1, y1, x2, y2);
  2312. }
  2313. /*****************************************************************************
  2314.  * FUNCTION
  2315.  *  dt_update_duration_cat19
  2316.  * DESCRIPTION
  2317.  *  update teh call time duration
  2318.  * PARAMETERS
  2319.  *  void
  2320.  * RETURNS
  2321.  *  void
  2322.  *****************************************************************************/
  2323. void dt_update_duration_cat19(void)
  2324. {
  2325.     /*----------------------------------------------------------------*/
  2326.     /* Local Variables                                                */
  2327.     /*----------------------------------------------------------------*/
  2328.     MYTIME curr_time, duration;
  2329.     MYTIME *start_time;
  2330.     /*----------------------------------------------------------------*/
  2331.     /* Code Body                                                      */
  2332.     /*----------------------------------------------------------------*/
  2333.     memset (&duration, 0, sizeof(MYTIME));
  2334.     DTGetRTCTime(&curr_time);
  2335.     start_time = GetCurrStartCallTime();
  2336.     if (start_time == NULL)
  2337.     {
  2338.         return;
  2339.     }
  2340.     /* overflow 2030/12/31/23:59:59 */
  2341.     if (start_time->nYear == 2030 && 
  2342.         curr_time.nYear < start_time->nYear)
  2343.     {
  2344.         curr_time.nYear = start_time->nYear;
  2345.         curr_time.nMonth = start_time->nMonth;
  2346.         curr_time.nDay = start_time->nDay+1;
  2347.     }
  2348.     GetTimeDifference(&curr_time, start_time, &duration);
  2349.     memcpy(&main_LCD_dt_object.duration.t, &duration, sizeof(MYTIME));
  2350.     if (!(FALSE == GetCallTimeDisplay()))
  2351.     {
  2352. dt_show_duration();
  2353.     }
  2354.     gui_start_timer(1000, dt_update_duration_cat19);
  2355. }
  2356. /*****************************************************************************
  2357.  * FUNCTION
  2358.  *  dt_update_duration
  2359.  * DESCRIPTION
  2360.  *  update teh call time duration
  2361.  * PARAMETERS
  2362.  *  void
  2363.  * RETURNS
  2364.  *  void
  2365.  *****************************************************************************/
  2366. void dt_update_duration(void)
  2367. {
  2368.     /*----------------------------------------------------------------*/
  2369.     /* Local Variables                                                */
  2370.     /*----------------------------------------------------------------*/
  2371.     MYTIME curr_time, duration;
  2372.     MYTIME *start_time;
  2373. #if 0
  2374. /* under construction !*/
  2375. /* under construction !*/
  2376. /* under construction !*/
  2377. #endif /* 0 */
  2378.     /*----------------------------------------------------------------*/
  2379.     /* Code Body                                                      */
  2380.     /*----------------------------------------------------------------*/
  2381.     memset (&duration, 0, sizeof(MYTIME));
  2382.     DTGetRTCTime(&curr_time);
  2383.     start_time = GetStartCallTime();
  2384.     if (start_time == NULL)
  2385.     {
  2386.         return;
  2387.     }
  2388.     /* overflow 2030/12/31/23:59:59 */
  2389.     if (start_time->nYear == 2030 && 
  2390.         curr_time.nYear < start_time->nYear)
  2391.     {
  2392.         curr_time.nYear = start_time->nYear;
  2393.         curr_time.nMonth = start_time->nMonth;
  2394.         curr_time.nDay = start_time->nDay+1;
  2395.     }
  2396.     GetTimeDifference(&curr_time, start_time, &duration);
  2397.     memcpy(&main_LCD_dt_object.duration.t, &duration, sizeof(MYTIME));
  2398.     if (!(FALSE == GetCallTimeDisplay()))
  2399.     {
  2400.         dt_show_duration();
  2401. #if 0
  2402. /* under construction !*/
  2403. /* under construction !*/
  2404. /* under construction !*/
  2405. /* under construction !*/
  2406. /* under construction !*/
  2407. /* under construction !*/
  2408. /* under construction !*/
  2409. /* under construction !*/
  2410. /* under construction !*/
  2411. /* under construction !*/
  2412. /* under construction !*/
  2413. /* under construction !*/
  2414. /* under construction !*/
  2415. /* under construction !*/
  2416. /* under construction !*/
  2417. /* under construction !*/
  2418. /* under construction !*/
  2419. /* under construction !*/
  2420. /* under construction !*/
  2421. /* under construction !*/
  2422. /* under construction !*/
  2423. /* under construction !*/
  2424. /* under construction !*/
  2425. #endif /* 0 */
  2426.     }
  2427.     gui_start_timer(1000, dt_update_duration);
  2428. }
  2429. /*****************************************************************************
  2430.  * FUNCTION
  2431.  *  dt_update_duration_gprs
  2432.  * DESCRIPTION
  2433.  *  
  2434.  * PARAMETERS
  2435.  *  void
  2436.  * RETURNS
  2437.  *  void
  2438.  *****************************************************************************/
  2439. void dt_update_duration_gprs(void)
  2440. {
  2441.     /*----------------------------------------------------------------*/
  2442.     /* Local Variables                                                */
  2443.     /*----------------------------------------------------------------*/
  2444. #if 0
  2445. /* under construction !*/
  2446. /* under construction !*/
  2447. /* under construction !*/
  2448. #endif /* 0 */
  2449.     /*----------------------------------------------------------------*/
  2450.     /* Code Body                                                      */
  2451.     /*----------------------------------------------------------------*/
  2452. #if 0
  2453. #if(UI_DOUBLE_BUFFER_SUPPORT)
  2454. /* under construction !*/
  2455. #endif 
  2456. #endif /* 0 */
  2457.     increment_seconds(&main_LCD_dt_object.duration.t);  /* increment secods by 1 */
  2458.     dt_show_duration();
  2459. #if 0
  2460. /* under construction !*/
  2461. /* under construction !*/
  2462. /* under construction !*/
  2463. /* under construction !*/
  2464. /* under construction !*/
  2465. /* under construction !*/
  2466. /* under construction !*/
  2467. /* under construction !*/
  2468. /* under construction !*/
  2469. /* under construction !*/
  2470. /* under construction !*/
  2471. /* under construction !*/
  2472. /* under construction !*/
  2473. /* under construction !*/
  2474. /* under construction !*/
  2475. /* under construction !*/
  2476. /* under construction !*/
  2477. /* under construction !*/
  2478. /* under construction !*/
  2479. /* under construction !*/
  2480. /* under construction !*/
  2481. /* under construction !*/
  2482. /* under construction !*/
  2483. /* under construction !*/
  2484. /* under construction !*/
  2485. /* under construction !*/
  2486. #endif /* 0 */
  2487.     gui_start_timer(1000, dt_update_duration_gprs);
  2488. }
  2489. /*****************************************************************************
  2490.  * FUNCTION
  2491.  *  CategoryScreenUpdateDuration
  2492.  * DESCRIPTION
  2493.  *  
  2494.  * PARAMETERS
  2495.  *  void
  2496.  * RETURNS
  2497.  *  void
  2498.  *****************************************************************************/
  2499. void Cat19UpdateDuration(MYTIME *t)
  2500. {
  2501.     /*----------------------------------------------------------------*/
  2502.     /* Local Variables                                                */
  2503.     /*----------------------------------------------------------------*/
  2504. MYTIME curr_time, duration;
  2505.     MYTIME *start_time;
  2506.     /*----------------------------------------------------------------*/
  2507.     /* Code Body                                                      */
  2508.     /*----------------------------------------------------------------*/
  2509.     memset (&duration, 0, sizeof(MYTIME));
  2510.     DTGetRTCTime(&curr_time);
  2511.     start_time = GetCurrStartCallTime();
  2512.     if (start_time == NULL)
  2513.     {
  2514.         return;
  2515.     }
  2516.     /* overflow 2030/12/31/23:59:59 */
  2517.     if (start_time->nYear == 2030 && 
  2518.         curr_time.nYear < start_time->nYear)
  2519.     {
  2520.         curr_time.nYear = start_time->nYear;
  2521.         curr_time.nMonth = start_time->nMonth;
  2522.         curr_time.nDay = start_time->nDay+1;
  2523.     }
  2524.     GetTimeDifference(&curr_time, start_time, &duration);
  2525.     gui_cancel_timer(dt_update_duration);
  2526.     set_dt_duration(&duration);
  2527.     if (!(FALSE == GetCallTimeDisplay()))
  2528.     {
  2529.         dt_show_duration();
  2530.     }
  2531.     gui_start_timer(1000, dt_update_duration_cat19);
  2532. }
  2533. /*****************************************************************************
  2534.  * FUNCTION
  2535.  *  reset_dt_display
  2536.  * DESCRIPTION
  2537.  *  set dt_display object to initialized value:0
  2538.  * PARAMETERS
  2539.  *  void
  2540.  * RETURNS
  2541.  *  void
  2542.  *****************************************************************************/
  2543. void reset_dt_display(void)
  2544. {
  2545.     /*----------------------------------------------------------------*/
  2546.     /* Local Variables                                                */
  2547.     /*----------------------------------------------------------------*/
  2548.     /*----------------------------------------------------------------*/
  2549.     /* Code Body                                                      */
  2550.     /*----------------------------------------------------------------*/
  2551.     main_LCD_dt_object.date.x = main_LCD_dt_object.date.y = 0;
  2552.     main_LCD_dt_object.date.height = main_LCD_dt_object.date.width = 0;
  2553.     main_LCD_dt_object.time.x = main_LCD_dt_object.time.y = 0;
  2554.     main_LCD_dt_object.time.height = main_LCD_dt_object.time.width = 0;
  2555. }
  2556. /*****************************************************************************
  2557.  * FUNCTION
  2558.  *  set_dt_display
  2559.  * DESCRIPTION
  2560.  *  set teh hide/dispaly function od date time depend on the
  2561.  *  date flag passed as parameter
  2562.  * PARAMETERS
  2563.  *  flags       [IN]        Date type flag
  2564.  * RETURNS
  2565.  *  void
  2566.  *****************************************************************************/
  2567. extern stFontAttribute wgui_dialer_box_f1;      //KP Jerry add on 2006-11-16
  2568. void set_dt_display(U32 flags)
  2569. {
  2570.     /*----------------------------------------------------------------*/
  2571.     /* Local Variables                                                */
  2572.     /*----------------------------------------------------------------*/
  2573.     /*----------------------------------------------------------------*/
  2574.     /* Code Body                                                      */
  2575.     /*----------------------------------------------------------------*/
  2576.     gdi_layer_lock_frame_buffer();
  2577.     switch (flags & DT_FLAGS_TYPE)
  2578.     {
  2579.         case DT_IDLE_SCREEN:
  2580.         {
  2581.             if (PhnsetGetShowDateTimeStatus() == MMI_FALSE)
  2582.             {
  2583.                 break;  /* check if dispaly tiem date on idel screen is enabel or not */
  2584.             }
  2585.             main_LCD_dt_object.flags = (flags & DT_FLAGS_TYPE);
  2586.             main_LCD_dt_object.date.hide_function = MMI_main_LCD_dt_date_hide_function;
  2587.             main_LCD_dt_object.time.hide_function = MMI_main_LCD_dt_time_hide_function;
  2588.         //PMT SUKRIT START 10112006
  2589.         #if defined(__MMI_UI_TECHNO_IDLESCREEN_BAR__) && defined(__MMI_MAINLCD_240X320__)
  2590. main_LCD_dt_object.date.font=&MMI_medium_font;     //Old:&MMI_large_font;    //KP Jerry modify on 2006-11-15
  2591.             //main_LCD_dt_object.date.text_color = gui_color(255, 255, 255);
  2592.             //main_LCD_dt_object.date.text_border_color = gui_color(18, 114, 175);
  2593.         #elif defined(__MMI_UI_DALMATIAN_IDLESCREEN__)
  2594.             main_LCD_dt_object.date.font = &MMI_medium_font;
  2595.             //main_LCD_dt_object.date.text_color = *current_MMI_theme->title_text_color;
  2596.             //main_LCD_dt_object.date.text_border_color = gui_color(255, 255, 255);
  2597.         #else 
  2598.             main_LCD_dt_object.date.font = &MMI_medium_font;
  2599.         #if 1
  2600.             //main_LCD_dt_object.date.text_color = *current_MMI_theme->idle_scr_date_color;
  2601.         #else 
  2602. /* under construction !*/
  2603.         #endif 
  2604.             //main_LCD_dt_object.date.text_border_color = gui_color(0, 0, 0);
  2605.         #endif 
  2606.             main_LCD_dt_object.date.text_color = *current_MMI_theme->idle_scr_date_color;
  2607.             main_LCD_dt_object.date.text_border_color = *current_MMI_theme->idle_scr_date_border_color;
  2608.         #ifdef __MMI_UI_DALMATIAN_IDLESCREEN__
  2609.             /* reset the display settings */
  2610.             main_LCD_dt_object.time.font = &MMI_medium_font;
  2611.             //main_LCD_dt_object.time.text_color = *current_MMI_theme->title_text_color;
  2612.             //main_LCD_dt_object.time.text_border_color = gui_color(255, 255, 255);
  2613.         #else /* __MMI_UI_DALMATIAN_IDLESCREEN__ */ 
  2614.         #if defined(__MMI_UI_TECHNO_IDLESCREEN_BAR__)
  2615. main_LCD_dt_object.time.font=&wgui_dialer_box_f1;      //Old:&MMI_medium_font;    //KP Jerry modify on 2006-11-16
  2616.         #else 
  2617.             main_LCD_dt_object.time.font = &MMI_large_font;
  2618.         #endif 
  2619.         #if 1
  2620.             //main_LCD_dt_object.time.text_color = *current_MMI_theme->idle_scr_time_color;       /* added by tk */
  2621.         #else 
  2622. /* under construction !*/
  2623.         #endif 
  2624.             //main_LCD_dt_object.time.text_border_color = gui_color(0, 0, 0);
  2625.             //main_LCD_dt_object.time.text_border_color = *current_MMI_theme->idle_scr_time_border_color;
  2626.         #endif /* __MMI_UI_DALMATIAN_IDLESCREEN__ */ 
  2627.             main_LCD_dt_object.time.text_color = *current_MMI_theme->idle_scr_time_color;
  2628.             main_LCD_dt_object.time.text_border_color = *current_MMI_theme->idle_scr_time_border_color;
  2629. //PMT SUKRIT END 10112006
  2630.             MMI_main_LCD_dt_hide_function = hide_main_LCD_date_time;    /* set function pointer of hide func of date time of main lcd */
  2631.             MMI_main_LCD_dt_display_function = show_main_LCD_date_time; /* set func piinter of show date time of main lcd */
  2632.         #ifdef __MMI_UI_TECHNO_IDLESCREEN_BAR__
  2633.             MMI_main_LCD_dt_update_function = dt_update_analog_clock;
  2634.         #else 
  2635.             MMI_main_LCD_dt_update_function = update_main_LCD_date_time;        /* set function of upadet date time of main lcd */
  2636.         #endif 
  2637.             MMI_main_LCD_dt_update_function();  /* upadet date tiem */
  2638.             enable_main_LCD_date_time_display = 0;
  2639.             MMI_main_LCD_dt_display_function(); /* display date tiem on main lcd */
  2640.             enable_main_LCD_date_time_display = 1;
  2641.         }
  2642.             break;
  2643.             /* Date/Time display is above softkeys */
  2644.         case DT_IDLE_SCREEN_2:
  2645.         {
  2646.             if (PhnsetGetShowDateTimeStatus() == MMI_FALSE)
  2647.             {
  2648.                 break;  /* check if dispaly tiem date on idel screen is enabel or not */
  2649.             }
  2650.             main_LCD_dt_object.flags = (flags & DT_FLAGS_TYPE);
  2651.             main_LCD_dt_object.date.hide_function = MMI_main_LCD_dt_date_hide_function;
  2652.             main_LCD_dt_object.time.hide_function = MMI_main_LCD_dt_time_hide_function;
  2653.             main_LCD_dt_object.date.font = &MMI_medium_font;
  2654. //PMT SUKRIT START 10112006
  2655.         #if 1
  2656.             main_LCD_dt_object.date.text_color = *current_MMI_theme->idle_scr_date_color;
  2657.         #else 
  2658. /* under construction !*/
  2659.         #endif 
  2660.             //main_LCD_dt_object.date.text_border_color = gui_color(0, 0, 0);
  2661.             main_LCD_dt_object.date.text_border_color = *current_MMI_theme->idle_scr_date_border_color;
  2662. //PMT SUKRIT END 10112006
  2663.             main_LCD_dt_object.time.font = &MMI_medium_font;
  2664. //PMT SUKRIT START 10112006
  2665.         #if 1
  2666.             main_LCD_dt_object.time.text_color = *current_MMI_theme->idle_scr_time_color;
  2667.         #else 
  2668. /* under construction !*/
  2669.         #endif 
  2670.             //main_LCD_dt_object.time.text_border_color = gui_color(0, 0, 0);
  2671.             main_LCD_dt_object.time.text_border_color = *current_MMI_theme->idle_scr_time_border_color;
  2672. //PMT SUKRIT END 10112006
  2673.             MMI_main_LCD_dt_hide_function = hide_main_LCD_date_time;    /* set function pointer of hide func of date time of main lcd */
  2674.             MMI_main_LCD_dt_display_function = show_main_LCD_date_time; /* set func piinter of show date time of main lcd */
  2675.             MMI_main_LCD_dt_update_function = update_main_LCD_date_time;        /* set function of upadet date time of main lcd */
  2676.             MMI_main_LCD_dt_update_function();  /* upadet date tiem */
  2677.             enable_main_LCD_date_time_display = 0;
  2678.             MMI_main_LCD_dt_display_function(); /* display date tiem on main lcd */
  2679.             enable_main_LCD_date_time_display = 1;
  2680.         }
  2681.             break;
  2682.         case DT_NETWORK_SEARCH:
  2683.         {
  2684.             main_LCD_dt_object.flags = (flags & DT_FLAGS_TYPE);
  2685.             main_LCD_dt_object.date.hide_function = MMI_main_LCD_dt_date_hide_function;
  2686.             main_LCD_dt_object.time.hide_function = MMI_main_LCD_dt_time_hide_function;
  2687.             main_LCD_dt_object.date.font = &MMI_small_font;
  2688.         #ifdef __MMI_UI_DALMATIAN_IDLESCREEN__
  2689.             main_LCD_dt_object.date.text_color = *current_MMI_theme->title_text_color;
  2690.             main_LCD_dt_object.date.text_border_color = gui_color(255, 255, 255);
  2691.         #else /* __MMI_UI_DALMATIAN_IDLESCREEN__ */ 
  2692.             main_LCD_dt_object.date.text_color = gui_color(0, 0, 0);
  2693.             main_LCD_dt_object.date.text_border_color = gui_color(255, 255, 255);
  2694.         #endif /* __MMI_UI_DALMATIAN_IDLESCREEN__ */ 
  2695.             main_LCD_dt_object.time.font = &MMI_medium_font;
  2696.         #ifdef __MMI_UI_DALMATIAN_IDLESCREEN__
  2697.             main_LCD_dt_object.time.text_color = *current_MMI_theme->title_text_color;
  2698.             main_LCD_dt_object.time.text_border_color = gui_color(255, 255, 255);
  2699.         #else /* __MMI_UI_DALMATIAN_IDLESCREEN__ */ 
  2700.             main_LCD_dt_object.time.text_color = gui_color(0, 0, 0);
  2701.             main_LCD_dt_object.time.text_border_color = gui_color(255, 255, 255);
  2702.         #endif /* __MMI_UI_DALMATIAN_IDLESCREEN__ */ 
  2703.             MMI_main_LCD_dt_hide_function = hide_main_LCD_date_time;    /* set function pointer of hide func of main lcd */
  2704.             MMI_main_LCD_dt_display_function = show_main_LCD_date_time; /* set function pointer of show date/time of main lcd */
  2705.             MMI_main_LCD_dt_update_function = update_main_LCD_date_time;        /* set function pointer of upadet date/time of main lcd */
  2706.             MMI_main_LCD_dt_update_function();
  2707.             enable_main_LCD_date_time_display = 0;
  2708.             MMI_main_LCD_dt_display_function();
  2709.             enable_main_LCD_date_time_display = 1;
  2710.         }
  2711.             break;
  2712.     #ifndef __MMI_CM_SCREEN_HIDE_DATE_TIME__
  2713.         case DT_MO_CALL_SCREEN:
  2714.         case DT_MO_CALLING_SCREEN:
  2715.         case DT_MT_CALL_SCREEN:
  2716.         {
  2717.             main_LCD_dt_object.flags = (flags & DT_FLAGS_TYPE);
  2718.             main_LCD_dt_object.date.hide_function = MMI_main_LCD_dt_date_hide_function;
  2719.             main_LCD_dt_object.time.hide_function = MMI_main_LCD_dt_time_hide_function;
  2720.             main_LCD_dt_object.date.font = &MMI_medium_font;
  2721.             main_LCD_dt_object.date.text_color = *current_MMI_theme->datetime_bar_date_text_color;
  2722.             main_LCD_dt_object.time.font = &MMI_medium_font;
  2723.             main_LCD_dt_object.time.text_color = *current_MMI_theme->datetime_bar_time_text_color;
  2724.             MMI_main_LCD_dt_hide_function = hide_main_LCD_date_time;
  2725.             MMI_main_LCD_dt_display_function = show_main_LCD_date_time;
  2726.             MMI_main_LCD_dt_update_function = update_main_LCD_date_time;
  2727.             MMI_main_LCD_dt_update_function();
  2728.             enable_main_LCD_date_time_display = 0;
  2729.             MMI_main_LCD_dt_display_function();
  2730.             enable_main_LCD_date_time_display = 1;
  2731.         }
  2732.             break;
  2733.         case DT_TABBED_CALL_SCREEN:
  2734.         case DT_ACTIVE_CALL_SCREEN:
  2735.         {
  2736.             main_LCD_dt_object.flags = (flags & DT_FLAGS_TYPE);
  2737.             main_LCD_dt_object.date.hide_function = MMI_main_LCD_dt_date_hide_function;
  2738.             main_LCD_dt_object.time.hide_function = MMI_main_LCD_dt_time_hide_function;
  2739.             main_LCD_dt_object.duration.hide_function = MMI_main_LCD_dt_duration_hide_function;
  2740.             main_LCD_dt_object.date.font = &MMI_medium_font;
  2741.             main_LCD_dt_object.date.text_color = *current_MMI_theme->datetime_bar_date_text_color;
  2742.             main_LCD_dt_object.time.font = &MMI_medium_font;
  2743.             main_LCD_dt_object.time.text_color = *current_MMI_theme->datetime_bar_time_text_color;
  2744.             main_LCD_dt_object.duration.font = &MMI_large_font;
  2745.             main_LCD_dt_object.duration.text_color = *current_MMI_theme->datetime_bar_duration_text_color;
  2746.             MMI_main_LCD_dt_hide_function = hide_main_LCD_date_time;
  2747.             MMI_main_LCD_dt_display_function = show_main_LCD_date_time;
  2748.             MMI_main_LCD_dt_update_function = update_main_LCD_date_time;
  2749.             if ((flags & DT_FLAGS_TYPE) == DT_TABBED_CALL_SCREEN)
  2750.             {
  2751.                 gui_start_timer(1000, dt_update_duration_gprs);
  2752.             }
  2753.             else
  2754.             {
  2755.                 gui_start_timer(1000, dt_update_duration);
  2756.             }
  2757.             MMI_main_LCD_dt_update_function();
  2758.             enable_main_LCD_date_time_display = 0;
  2759.             MMI_main_LCD_dt_display_function();
  2760.             enable_main_LCD_date_time_display = 1;
  2761.         }
  2762.             break;
  2763.     #endif /* __MMI_CM_SCREEN_HIDE_DATE_TIME__ */ 
  2764.         case DT_GPRS_ACTIVE_CALL:
  2765.         {
  2766.             main_LCD_dt_object.flags = (flags & DT_FLAGS_TYPE);
  2767.             main_LCD_dt_object.duration.hide_function = MMI_main_LCD_dt_duration_hide_function;
  2768.             main_LCD_dt_object.duration.font = &MMI_small_font;
  2769.             main_LCD_dt_object.duration.text_color = *current_MMI_theme->datetime_bar_duration_text_color;
  2770.             main_LCD_dt_object.duration.x = 0;
  2771.             main_LCD_dt_object.duration.y = MMI_status_bar_height;
  2772.             main_LCD_dt_object.duration.width = UI_device_width - 1;
  2773.             main_LCD_dt_object.duration.height = DURATION_CM_HEIGHT;
  2774.             MMI_main_LCD_dt_display_function = show_main_LCD_date_time; /* set func piinter of show date time of main lcd */
  2775.             MMI_main_LCD_dt_update_function = update_main_LCD_date_time;
  2776.             gui_start_timer(1000, dt_update_duration_gprs);
  2777.             enable_main_LCD_date_time_display = 0;
  2778.             MMI_main_LCD_dt_display_function();
  2779.             enable_main_LCD_date_time_display = 1;
  2780.         }
  2781.             break;
  2782.         case DT_GPRS_CONF_CALL:
  2783.         {
  2784.             main_LCD_dt_object.flags = (flags & DT_FLAGS_TYPE);
  2785.             main_LCD_dt_object.duration.hide_function = MMI_main_LCD_dt_duration_hide_function;
  2786.             main_LCD_dt_object.duration.font = &MMI_medium_font;
  2787.             main_LCD_dt_object.duration.text_color = *current_MMI_theme->datetime_bar_duration_text_color;
  2788.             main_LCD_dt_object.duration.x = 0;
  2789.             main_LCD_dt_object.duration.y = MMI_status_bar_height + 20;
  2790.             main_LCD_dt_object.duration.width = UI_device_width - 1;
  2791.             main_LCD_dt_object.duration.height = DURATION_CM_HEIGHT;
  2792.             MMI_main_LCD_dt_display_function = show_main_LCD_date_time; /* set func piinter of show date time of main lcd */
  2793.             MMI_main_LCD_dt_update_function = update_main_LCD_date_time;
  2794.             gui_start_timer(1000, dt_update_duration_gprs);
  2795.             enable_main_LCD_date_time_display = 0;
  2796.             MMI_main_LCD_dt_display_function();
  2797.             enable_main_LCD_date_time_display = 1;
  2798.         }
  2799.     #ifdef __MMI_SUBLCD__
  2800.         case DT_SUBLCD_IDLE_SCREEN1:
  2801.         {
  2802.             sub_LCD_dt_object1.flags = (flags & DT_FLAGS_TYPE);
  2803.             sub_LCD_dt_object1.date.hide_function = MMI_sub_LCD_dt_date_hide_function;
  2804.             sub_LCD_dt_object1.time.hide_function = MMI_sub_LCD_dt_time_hide_function;
  2805.             sub_LCD_dt_object1.date.font = &MMI_small_font;
  2806.             sub_LCD_dt_object1.date.text_color = gui_color(0, 0, 0);
  2807.             sub_LCD_dt_object1.time.font = &MMI_medium_font;
  2808.             sub_LCD_dt_object1.time.text_color = gui_color(0, 0, 0);
  2809.             sub_LCD_dt_object2.flags = (flags & DT_FLAGS_TYPE);
  2810.             sub_LCD_dt_object2.date.hide_function = MMI_sub_LCD_dt_date_hide_function;
  2811.             sub_LCD_dt_object2.time.hide_function = MMI_sub_LCD_dt_time_hide_function;
  2812.             sub_LCD_dt_object2.date.font = &MMI_small_font;
  2813.             sub_LCD_dt_object2.date.text_color = gui_color(0, 0, 0);
  2814.             sub_LCD_dt_object2.time.font = &MMI_medium_font;
  2815.             sub_LCD_dt_object2.time.text_color = gui_color(0, 0, 0);
  2816.             MMI_sub_LCD_dt_hide_function = hide_sub_LCD_date_time1;
  2817.             MMI_sub_LCD_dt_display_function = show_sub_LCD_date_time1;
  2818.             MMI_sub_LCD_dt_update_function = update_sub_LCD_date_time1;
  2819.             MMI_sub_LCD_dt_update_function();
  2820.             enable_sub_LCD_date_time_display = 0;
  2821.             MMI_sub_LCD_dt_display_function();
  2822.             enable_sub_LCD_date_time_display = 1;
  2823.         }
  2824.             break;
  2825.         case DT_SUBLCD_IDLE_SCREEN2:
  2826.         {
  2827.             sublcd_date_time_display_type = SUBLCD_DT_DATE_THEN_TIME_TYPE1;
  2828.             sub_LCD_dt_object1.flags = (flags & DT_FLAGS_TYPE);
  2829.             sub_LCD_dt_object1.date.hide_function = MMI_sub_LCD_dt_date_hide_function;
  2830.             sub_LCD_dt_object1.time.hide_function = MMI_sub_LCD_dt_time_hide_function;
  2831.         #ifdef __MMI_SUBLCD_DATE_LARGE_FONT__
  2832.             sub_LCD_dt_object1.date.font = &MMI_large_font;
  2833.         #else 
  2834.             sub_LCD_dt_object1.date.font = &MMI_small_font;
  2835.         #endif 
  2836.         #ifdef __MMI_SUB_WALLPAPER__
  2837.             sub_LCD_dt_object1.date.text_color = gui_color(255, 255, 255);
  2838.             sub_LCD_dt_object1.date.text_border_color = gui_color(0, 0, 0);
  2839.         #else /* __MMI_SUB_WALLPAPER__ */ 
  2840.             sub_LCD_dt_object1.date.text_color = gui_color(0, 0, 0);
  2841.         #endif /* __MMI_SUB_WALLPAPER__ */ 
  2842.         #ifdef __MMI_SUBLCD_TIME_LARGE_FONT__
  2843.             sub_LCD_dt_object1.time.font = &MMI_large_font;
  2844.         #else 
  2845.             sub_LCD_dt_object1.time.font = &MMI_medium_font;
  2846.         #endif 
  2847.         #ifdef __MMI_SUB_WALLPAPER__
  2848.             sub_LCD_dt_object1.time.text_color = gui_color(255, 255, 255);
  2849.             sub_LCD_dt_object1.time.text_border_color = gui_color(0, 0, 0);
  2850.         #else /* __MMI_SUB_WALLPAPER__ */ 
  2851.             sub_LCD_dt_object1.time.text_color = gui_color(0, 0, 0);
  2852.         #endif /* __MMI_SUB_WALLPAPER__ */ 
  2853.             MMI_sub_LCD_dt_hide_function = hide_sub_LCD_date_time2;
  2854.             MMI_sub_LCD_dt_display_function = show_sub_LCD_date_time2;
  2855.             MMI_sub_LCD_dt_update_function = update_sub_LCD_date_time2;
  2856.             MMI_sub_LCD_dt_update_function();
  2857.             enable_sub_LCD_date_time_display = 0;
  2858.             MMI_sub_LCD_dt_display_function();
  2859.             enable_sub_LCD_date_time_display = 1;
  2860.         }
  2861.             break;
  2862.         case DT_SUBLCD_IDLE_SCREEN3:
  2863.         {
  2864.             sublcd_date_time_display_type = SUBLCD_DT_TIME_THEN_DATE_TYPE1;
  2865.             sub_LCD_dt_object1.flags = (flags & DT_FLAGS_TYPE);
  2866.             sub_LCD_dt_object1.date.hide_function = MMI_sub_LCD_dt_date_hide_function;
  2867.             sub_LCD_dt_object1.time.hide_function = MMI_sub_LCD_dt_time_hide_function;
  2868.         #ifdef __MMI_SUBLCD_DATE_LARGE_FONT__
  2869.             sub_LCD_dt_object1.date.font = &MMI_large_font;
  2870.         #else 
  2871.             sub_LCD_dt_object1.date.font = &MMI_small_font;
  2872.         #endif 
  2873.         #ifdef __MMI_SUB_WALLPAPER__
  2874.             sub_LCD_dt_object1.date.text_color = gui_color(255, 255, 255);
  2875.             sub_LCD_dt_object1.date.text_border_color = gui_color(0, 0, 0);
  2876.         #else /* __MMI_SUB_WALLPAPER__ */ 
  2877.             sub_LCD_dt_object1.date.text_color = gui_color(0, 0, 0);
  2878.         #endif /* __MMI_SUB_WALLPAPER__ */ 
  2879.         #ifdef __MMI_SUBLCD_TIME_LARGE_FONT__
  2880.             sub_LCD_dt_object1.time.font = &MMI_sublcd_font;
  2881.         #else 
  2882.             sub_LCD_dt_object1.time.font = &MMI_medium_font;
  2883.         #endif 
  2884.         #ifdef __MMI_SUB_WALLPAPER__
  2885.             sub_LCD_dt_object1.time.text_color = gui_color(255, 255, 255);
  2886.             sub_LCD_dt_object1.time.text_border_color = gui_color(0, 0, 0);
  2887.         #else /* __MMI_SUB_WALLPAPER__ */ 
  2888.             sub_LCD_dt_object1.time.text_color = gui_color(0, 0, 0);
  2889.         #endif /* __MMI_SUB_WALLPAPER__ */ 
  2890.             MMI_sub_LCD_dt_hide_function = hide_sub_LCD_date_time2;
  2891.             MMI_sub_LCD_dt_display_function = show_sub_LCD_date_time2;
  2892.             MMI_sub_LCD_dt_update_function = update_sub_LCD_date_time2;
  2893.             MMI_sub_LCD_dt_update_function();
  2894.             enable_sub_LCD_date_time_display = 0;
  2895.             MMI_sub_LCD_dt_display_function();
  2896.             enable_sub_LCD_date_time_display = 1;
  2897.         }
  2898.             break;
  2899.         case DT_SUBLCD_IDLE_SCREEN4:
  2900.         {
  2901.             sublcd_date_time_display_type = SUBLCD_DT_TIME_THEN_DATE_TYPE1;
  2902.             sub_LCD_dt_object1.flags = (flags & DT_FLAGS_TYPE);
  2903.             sub_LCD_dt_object1.date.hide_function = MMI_sub_LCD_dt_date_hide_function;
  2904.             sub_LCD_dt_object1.time.hide_function = MMI_sub_LCD_dt_time_hide_function;
  2905.             sub_LCD_dt_object1.date.font = &MMI_medium_font;
  2906.         #ifdef __MMI_SUB_WALLPAPER__
  2907.             sub_LCD_dt_object1.date.text_color = gui_color(255, 255, 255);
  2908.             sub_LCD_dt_object1.date.text_border_color = gui_color(0, 0, 0);
  2909.         #else /* __MMI_SUB_WALLPAPER__ */ 
  2910.             sub_LCD_dt_object1.date.text_color = gui_color(130, 230, 220);
  2911.         #endif /* __MMI_SUB_WALLPAPER__ */ 
  2912.             sub_LCD_dt_object1.time.font = &MMI_sublcd_font;
  2913.         #ifdef __MMI_SUB_WALLPAPER__
  2914.             sub_LCD_dt_object1.time.text_color = gui_color(255, 255, 255);
  2915.             sub_LCD_dt_object1.time.text_border_color = gui_color(0, 0, 0);
  2916.         #else /* __MMI_SUB_WALLPAPER__ */ 
  2917.             sub_LCD_dt_object1.time.text_color = gui_color(255, 255, 0);
  2918.         #endif /* __MMI_SUB_WALLPAPER__ */ 
  2919.             MMI_sub_LCD_dt_hide_function = hide_sub_LCD_date_time2;
  2920.             MMI_sub_LCD_dt_display_function = show_sub_LCD_date_time2;
  2921.             MMI_sub_LCD_dt_update_function = update_sub_LCD_date_time2;
  2922.             MMI_sub_LCD_dt_update_function();
  2923.             enable_sub_LCD_date_time_display = 0;
  2924.             MMI_sub_LCD_dt_display_function();
  2925.             enable_sub_LCD_date_time_display = 1;
  2926.         }
  2927.             break;
  2928.     #endif /* __MMI_SUBLCD__ */ 
  2929.         case DT_DIGITAL_CLOCK_SC1:
  2930.         case DT_DIGITAL_CLOCK_SC2:
  2931.         case DT_DIGITAL_CLOCK_SC3:
  2932.         {
  2933.             if (PhnsetGetShowDateTimeStatus() == MMI_FALSE)
  2934.             {
  2935.                 show_date = 1;
  2936.             }
  2937.             else
  2938.             {
  2939.                 show_date = 0;
  2940.             }
  2941.             main_LCD_dt_object.flags = (flags & DT_FLAGS_TYPE);
  2942.             main_LCD_dt_object.date.hide_function = MMI_main_LCD_dt_date_hide_function;
  2943.             main_LCD_dt_object.time.hide_function = MMI_main_LCD_dt_time_hide_function;
  2944.             main_LCD_dt_object.date.font = &MMI_medium_font;
  2945.         #ifdef __MMI_UI_DALMATIAN_IDLESCREEN__
  2946.             main_LCD_dt_object.date.text_color = *current_MMI_theme->title_text_color;
  2947.             main_LCD_dt_object.date.text_border_color = gui_color(255, 255, 255);
  2948.             main_LCD_dt_object.time.font = &MMI_medium_font;
  2949.             main_LCD_dt_object.time.text_color = *current_MMI_theme->title_text_color;
  2950.             main_LCD_dt_object.time.text_border_color = gui_color(255, 255, 255);
  2951.         #else /* __MMI_UI_DALMATIAN_IDLESCREEN__ */ 
  2952.             main_LCD_dt_object.date.text_color = gui_color(0, 0, 0);
  2953.             main_LCD_dt_object.date.text_border_color = gui_color(255, 255, 255);
  2954.             main_LCD_dt_object.time.font = &MMI_large_font;
  2955.             main_LCD_dt_object.time.text_color = gui_color(0, 0, 0);
  2956.             main_LCD_dt_object.time.text_border_color = gui_color(255, 255, 255);
  2957.         #endif /* __MMI_UI_DALMATIAN_IDLESCREEN__ */ 
  2958.             MMI_main_LCD_dt_hide_function = hide_main_LCD_date_time;
  2959.             MMI_main_LCD_dt_display_function = show_main_LCD_date_time;
  2960.             MMI_main_LCD_dt_update_function = update_main_LCD_date_time;
  2961.             MMI_main_LCD_dt_update_function();
  2962.             enable_main_LCD_date_time_display = 0;
  2963.             MMI_main_LCD_dt_display_function();
  2964.             enable_main_LCD_date_time_display = 1;
  2965.         }
  2966.             break;
  2967.     #ifdef __MMI_ANALOG_CLOCK__
  2968.         case DT_ANALOG_CLOCK_SC:
  2969.         {
  2970.             if (PhnsetGetShowDateTimeStatus() == MMI_FALSE) /* check if display of date is enable on idle screen or not */
  2971.             {
  2972.                 show_date = 1;
  2973.             }
  2974.             else
  2975.             {
  2976.                 show_date = 0;
  2977.             }
  2978.             main_LCD_dt_object.flags = (flags & DT_FLAGS_TYPE);
  2979.             main_LCD_dt_object.date.hide_function = MMI_main_LCD_dt_date_hide_function;
  2980.             main_LCD_dt_object.time.hide_function = MMI_main_LCD_dt_time_hide_function;
  2981.             main_LCD_dt_object.date.font = &MMI_medium_font;
  2982.         #ifdef __MMI_UI_DALMATIAN_IDLESCREEN__
  2983.             main_LCD_dt_object.date.text_color = *current_MMI_theme->title_text_color;
  2984.             main_LCD_dt_object.date.text_border_color = gui_color(255, 255, 255);
  2985.         #else /* __MMI_UI_DALMATIAN_IDLESCREEN__ */ 
  2986.             main_LCD_dt_object.date.text_color = gui_color(0, 0, 0);
  2987.             main_LCD_dt_object.date.text_border_color = gui_color(255, 255, 255);
  2988.         #endif /* __MMI_UI_DALMATIAN_IDLESCREEN__ */ 
  2989.             MMI_main_LCD_dt_hide_function = hide_main_LCD_date_time;
  2990.             MMI_main_LCD_dt_display_function = show_main_LCD_date_time;
  2991.             MMI_main_LCD_dt_update_function = dt_update_analog_clock;
  2992.             MMI_main_LCD_dt_update_function();
  2993.             enable_main_LCD_date_time_display = 0;
  2994.             MMI_main_LCD_dt_display_function();
  2995.             enable_main_LCD_date_time_display = 1;
  2996.         }
  2997.             break;
  2998.     #endif /* __MMI_ANALOG_CLOCK__ */ 
  2999.         case DT_AUDIO_PLAY_DURATION:
  3000.         {
  3001.             main_LCD_dt_object.flags = (flags & DT_FLAGS_TYPE);
  3002.             main_LCD_dt_object.duration.x = 6;
  3003.             main_LCD_dt_object.duration.y = 30;
  3004.             main_LCD_dt_object.duration.width = 44;
  3005.             main_LCD_dt_object.duration.height = 19;
  3006.             main_LCD_dt_object.duration.hide_function = MMI_main_LCD_dt_duration_hide_function;
  3007.         #ifdef __MMI_UI_DALMATIAN_IDLESCREEN__
  3008.             main_LCD_dt_object.duration.font = &MMI_medium_font;
  3009.             main_LCD_dt_object.duration.text_color = *current_MMI_theme->title_text_color;
  3010.         #else /* __MMI_UI_DALMATIAN_IDLESCREEN__ */ 
  3011.             main_LCD_dt_object.duration.font = &MMI_large_font;
  3012.             main_LCD_dt_object.duration.text_color = gui_color(0, 255, 0);
  3013.         #endif /* __MMI_UI_DALMATIAN_IDLESCREEN__ */ 
  3014.             MMI_main_LCD_dt_display_function = show_main_LCD_date_time;
  3015.             MMI_main_LCD_dt_update_function = update_main_LCD_date_time;
  3016.             MMI_main_LCD_dt_update_function();
  3017.             enable_main_LCD_date_time_display = 0;
  3018.             MMI_main_LCD_dt_display_function();
  3019.             enable_main_LCD_date_time_display = 1;
  3020.         }
  3021.             break;
  3022.     #ifdef __MMI_SUBLCD_SHOW_ANALOG_CLOCK__
  3023.         case DT_SUBLCD_ANALOG_CLOCK:
  3024.         {
  3025.             MMI_sub_LCD_dt_hide_function = UI_dummy_function;
  3026.             MMI_sub_LCD_dt_display_function = RedrawSubLCDAnalogClockScreen;
  3027.             MMI_sub_LCD_dt_update_function = dt_update_analog_clock;
  3028.         }
  3029.             break;
  3030.     #endif /* __MMI_SUBLCD_SHOW_ANALOG_CLOCK__ */ 
  3031.         default:
  3032.             reset_dt_display();
  3033.     }
  3034.     gdi_layer_unlock_frame_buffer();
  3035. }
  3036. /*****************************************************************************
  3037.  * FUNCTION
  3038.  *  close_main_LCD_dt_display
  3039.  * DESCRIPTION
  3040.  *  set all function pointer of date tiem display ofmain lcd
  3041.  *  to dummy functions
  3042.  * PARAMETERS
  3043.  *  void
  3044.  * RETURNS
  3045.  *  void
  3046.  *****************************************************************************/
  3047. void close_main_LCD_dt_display(void)
  3048. {
  3049.     /*----------------------------------------------------------------*/
  3050.     /* Local Variables                                                */
  3051.     /*----------------------------------------------------------------*/
  3052.     /*----------------------------------------------------------------*/
  3053.     /* Code Body                                                      */
  3054.     /*----------------------------------------------------------------*/
  3055.     MMI_main_LCD_dt_update_function = UI_dummy_function;
  3056.     MMI_main_LCD_dt_display_function = UI_dummy_function;
  3057.     MMI_main_LCD_dt_hide_function = UI_dummy_function;
  3058.     MMI_main_LCD_dt_close_function();
  3059.     MMI_main_LCD_dt_close_function = UI_dummy_function;
  3060.     MMI_main_LCD_dt_date_hide_function = UI_dummy_hide_function;
  3061.     MMI_main_LCD_dt_time_hide_function = UI_dummy_hide_function;
  3062.     MMI_main_LCD_dt_duration_hide_function = UI_dummy_hide_function;
  3063.     gui_cancel_timer(dt_update_duration);
  3064.     gui_cancel_timer(dt_update_duration_gprs);
  3065.     gui_cancel_timer(dt_update_duration_cat19);
  3066. }
  3067. /*****************************************************************************