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

MTK

开发平台:

C/C++

  1. /*****************************************************************************
  2. *  Copyright Statement:
  3. *  --------------------
  4. *  This software is protected by Copyright and the information contained
  5. *  herein is confidential. The software may not be copied and the information
  6. *  contained herein may not be used or disclosed except with the written
  7. *  permission of MediaTek Inc. (C) 2005
  8. *
  9. *  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
  10. *  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
  11. *  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
  12. *  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
  13. *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
  14. *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
  15. *  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
  16. *  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
  17. *  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
  18. *  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
  19. *  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
  20. *  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
  21. *
  22. *  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
  23. *  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
  24. *  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
  25. *  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
  26. *  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. 
  27. *
  28. *  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
  29. *  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
  30. *  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
  31. *  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
  32. *  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
  33. *
  34. *****************************************************************************/
  35. /*****************************************************************************
  36.  *
  37.  * Filename: 
  38.  * ---------
  39.  *   wgui_categories_popup.c
  40.  *
  41.  * Project:
  42.  * --------
  43.  *   Maui_Software
  44.  *
  45.  * Description:
  46.  * ------------
  47.  *  Popup screen related categories.
  48.  *
  49.  * Author:
  50.  * -------
  51.  * -------
  52.  *
  53.  *============================================================================
  54.  *             HISTORY
  55.  * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  56.  *------------------------------------------------------------------------------
  57.  * removed!
  58.  *
  59.  * removed!
  60.  * removed!
  61.  * removed!
  62.  *
  63.  * removed!
  64.  * removed!
  65.  * removed!
  66.  *
  67.  * removed!
  68.  * removed!
  69.  * removed!
  70.  *
  71.  * removed!
  72.  * removed!
  73.  * removed!
  74.  *
  75.  * removed!
  76.  * removed!
  77.  * removed!
  78.  *
  79.  * removed!
  80.  * removed!
  81.  * removed!
  82.  *
  83.  * removed!
  84.  * removed!
  85.  * removed!
  86.  *
  87.  * removed!
  88.  * removed!
  89.  * removed!
  90.  *
  91.  * removed!
  92.  * removed!
  93.  * removed!
  94.  *
  95.  * removed!
  96.  * removed!
  97.  * removed!
  98.  *
  99.  * removed!
  100.  * removed!
  101.  * removed!
  102.  *
  103.  * removed!
  104.  * removed!
  105.  * removed!
  106.  *
  107.  * removed!
  108.  * removed!
  109.  * removed!
  110.  *
  111.  * removed!
  112.  * removed!
  113.  * removed!
  114.  *
  115.  * removed!
  116.  * removed!
  117.  * removed!
  118.  *
  119.  * removed!
  120.  * removed!
  121.  * removed!
  122.  *
  123.  * removed!
  124.  * removed!
  125.  * removed!
  126.  *
  127.  * removed!
  128.  * removed!
  129.  * removed!
  130.  *
  131.  * removed!
  132.  * removed!
  133.  * removed!
  134.  *
  135.  * removed!
  136.  * removed!
  137.  * removed!
  138.  *
  139.  * removed!
  140.  * removed!
  141.  * removed!
  142.  *
  143.  * removed!
  144.  * removed!
  145.  * removed!
  146.  *
  147.  * removed!
  148.  * removed!
  149.  * removed!
  150.  *
  151.  * removed!
  152.  * removed!
  153.  * removed!
  154.  *
  155.  * removed!
  156.  * removed!
  157.  * removed!
  158.  *
  159.  * removed!
  160.  * removed!
  161.  * removed!
  162.  *
  163.  * removed!
  164.  * removed!
  165.  * removed!
  166.  *
  167.  * removed!
  168.  * removed!
  169.  * removed!
  170.  *
  171.  * removed!
  172.  * removed!
  173.  * removed!
  174.  *
  175.  * removed!
  176.  * removed!
  177.  * removed!
  178.  *
  179.  * removed!
  180.  * removed!
  181.  * removed!
  182.  *
  183.  * removed!
  184.  * removed!
  185.  * removed!
  186.  *
  187.  * removed!
  188.  * removed!
  189.  * removed!
  190.  *
  191.  * removed!
  192.  * removed!
  193.  * removed!
  194.  *
  195.  * removed!
  196.  * removed!
  197.  * removed!
  198.  *
  199.  * removed!
  200.  * removed!
  201.  * removed!
  202.  *
  203.  * removed!
  204.  * removed!
  205.  * removed!
  206.  *
  207.  * removed!
  208.  * removed!
  209.  * removed!
  210.  *
  211.  * removed!
  212.  * removed!
  213.  * removed!
  214.  *
  215.  *------------------------------------------------------------------------------
  216.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  217.  *============================================================================
  218.  ****************************************************************************/
  219. #include "MMI_features.h"
  220. #include "stdC.h"
  221. #include "L4Dr1.h"
  222. #include "PixtelDataTypes.h"
  223. #include "GlobalDefs.h"
  224. #include "gui_data_types.h"
  225. #include "CustDataProts.h"
  226. #include "CustMenuRes.h"
  227. #include "EventsDef.h"
  228. #include "gui_themes.h"
  229. #include "wgui.h"
  230. #include "CustThemesRes.h"
  231. #include "gdi_include.h"
  232. #include "wgui_inputs.h"
  233. #include "wgui_categories.h"
  234. #include "wgui_softkeys.h"
  235. #include "wgui_status_icons.h"
  236. #include "wgui_categories_popup.h"
  237. #include "wgui_categories_inputs.h"
  238. #include "wgui_categories_defs.h"
  239. #include "TimerEvents.h"
  240. #include "HistoryGprot.h"       /* __MMI_UI_SMALL_SCREEN_SUPPORT__ */
  241. #if defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__)
  242. #include "wgui_touch_screen.h"
  243. #include "PhoneSetupGprots.h"
  244. #endif /* defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__) */ 
  245. #ifdef __MMI_HANDWRITING_PAD__
  246. #include "touch_panel_custom.h"
  247. #endif 
  248. #include "wgui_draw_manager.h"
  249. #include "CommonScreens.h"      /* 101705 */
  250. #include "QuickAccessMenuItemProt.h"
  251. #include "ScreenRotationGprot.h"
  252. #include "DebugInitDef.h"
  253. #include "IdleAppDef.h"
  254. #include "IdleAppProt.h"
  255. #include "SettingProfile.h"
  256. #include "datetimetype.h"
  257. #include "app_datetime.h"
  258. extern UI_string_type MMI_message_string;
  259. extern PU8 MMI_message_icon;
  260. /*
  261.  * extern S16 Painty1;
  262.  * extern S16 Painty2;
  263.  */
  264. extern S32 wgui_image_clip_y1;
  265. extern S32 wgui_image_clip_y2;
  266. extern S16 status_icon;
  267. extern FuncPtr PopupFunc;
  268. //micha1021, Joyce Requirement, Here to change pop up window background and color
  269. //Check in Main Trunk ONLY
  270. //#ifdef __MMI_PLUTO_GPRS__
  271. UI_filled_area greywgui_pop_up_dialog_background =
  272.     {UI_FILLED_AREA_TYPE_COLOR | UI_FILLED_AREA_DOUBLE_BORDER | UI_FILLED_AREA_ROUNDED_BORDER |
  273. UI_FILLED_AREA_SHADOW_DOUBLE_LINE | UI_FILLED_AREA_SHADOW,
  274.     UI_NULL_IMAGE,
  275.     NULL,
  276.     {234, 234, 234, 100},
  277.     {0, 0, 0, 0},
  278.     {142, 204, 145, 100},
  279.     {50, 50, 50, 100},
  280.     0
  281. };
  282. // #endif
  283. #ifdef __MMI_DEFAULT_THEME_1__
  284. UI_filled_area wgui_pop_up_dialog_background =
  285.     {UI_FILLED_AREA_TYPE_COLOR | UI_FILLED_AREA_DOUBLE_BORDER | UI_FILLED_AREA_ROUNDED_BORDER |
  286. UI_FILLED_AREA_SHADOW_DOUBLE_LINE | UI_FILLED_AREA_SHADOW,
  287.     UI_NULL_IMAGE,
  288.     NULL,
  289.     {246, 255, 171, 100},
  290.     {0, 0, 0, 0},
  291.     {142, 204, 145, 100},
  292.     {50, 50, 50, 100},
  293.     0
  294. };
  295. UI_filled_area wgui_pop_up_dialog_inputbox_background = {UI_FILLED_AREA_TYPE_COLOR,
  296.     UI_NULL_IMAGE,
  297.     NULL,
  298.     {246, 255, 171, 100},
  299.     {0, 0, 0, 0},
  300.     {0, 0, 0, 0},
  301.     {0, 0, 0, 0},
  302.     0
  303. };
  304. #else /* __MMI_DEFAULT_THEME_1__ */ 
  305. UI_filled_area wgui_pop_up_dialog_background =
  306.     {UI_FILLED_AREA_TYPE_COLOR | UI_FILLED_AREA_DOUBLE_BORDER | UI_FILLED_AREA_ROUNDED_BORDER |
  307. UI_FILLED_AREA_SHADOW_DOUBLE_LINE | UI_FILLED_AREA_SHADOW,
  308.     UI_NULL_IMAGE,
  309.     NULL,
  310.     {255, 255, 255, 100},
  311.     {0, 0, 0, 0},
  312.     {0, 0, 0, 100},
  313.     {50, 50, 50, 100},
  314.     0
  315. };
  316. UI_filled_area wgui_pop_up_dialog_inputbox_background = {UI_FILLED_AREA_TYPE_COLOR,
  317.     UI_NULL_IMAGE,
  318.     NULL,
  319.     {255, 255, 255, 100},
  320.     {0, 0, 0, 0},
  321.     {0, 0, 0, 0},
  322.     {0, 0, 0, 0},
  323.     0
  324. };
  325. #endif /* __MMI_DEFAULT_THEME_1__ */ 
  326. UI_filled_area borderwgui_pop_up_dialog_background = {UI_FILLED_AREA_TYPE_COLOR | UI_FILLED_AREA_SINGLE_BORDER,
  327.     UI_NULL_IMAGE,
  328.     NULL,
  329.     {255, 255, 255, 100},
  330.     {0, 0, 0, 0},
  331.     {0, 0, 0, 100},
  332.     {50, 50, 50, 100},
  333.     0
  334. };
  335. /*****************************************************************************
  336.  * FUNCTION
  337.  *  ShowCommonCategoryPopupScreen
  338.  * DESCRIPTION
  339.  *  Displays the category63 screen
  340.  * PARAMETERS
  341.  *  message             [IN]        Message string
  342.  *  history_buffer      [IN]        History buffer
  343.  *  MMI_ID_TYPE(?)      [IN]        Icon        Message icon
  344.  * RETURNS
  345.  *  void
  346.  *****************************************************************************/
  347. void ShowCommonCategoryPopupScreen(UI_string_type message, U8 *history_buffer)
  348. {
  349.     /*----------------------------------------------------------------*/
  350.     /* Local Variables                                                */
  351.     /*----------------------------------------------------------------*/
  352.     S32 l;
  353.     /*----------------------------------------------------------------*/
  354.     /* Code Body                                                      */
  355.     /*----------------------------------------------------------------*/
  356.     UI_UNUSED_PARAMETER(history_buffer);
  357.     gui_lock_double_buffer();
  358.     entry_full_screen();
  359.     clear_category_screen_key_handlers();
  360.     clear_left_softkey();
  361.     clear_right_softkey();
  362.     MMI_message_string = message;
  363.     l = gui_strlen(MMI_message_string);
  364.     create_multiline_inputbox_set_buffer(MMI_message_string, l, l, 0);
  365.     MMI_multiline_inputbox.flags |= UI_MULTI_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW
  366.         | UI_MULTI_LINE_INPUT_BOX_CENTER_JUSTIFY
  367.         | UI_MULTI_LINE_INPUT_BOX_DISABLE_BACKGROUND
  368.         | UI_MULTI_LINE_INPUT_BOX_DISABLE_SCROLLBAR | UI_MULTI_LINE_INPUT_BOX_VIEW_MODE;
  369.     MMI_multiline_inputbox.ext_flags |= GUI_MULTI_LINE_INPUT_BOX_TRUNCATE_CONTENT;
  370.     gui_unlock_double_buffer();
  371. }
  372. /*****************************************************************************
  373.  * FUNCTION
  374.  *  ShowCommonCategoryPopupScreenType2
  375.  * DESCRIPTION
  376.  *  
  377.  * PARAMETERS
  378.  *  title                   [IN]        
  379.  *  title_icon              [IN]        
  380.  *  left_softkey            [IN]        
  381.  *  left_softkey_icon       [IN]        
  382.  *  right_softkey           [IN]        
  383.  *  right_softkey_icon      [IN]        
  384.  *  message                 [IN]        
  385.  *  history_buffer          [?]         
  386.  * RETURNS
  387.  *  void
  388.  *****************************************************************************/
  389. void ShowCommonCategoryPopupScreenType2(
  390.         U16 title,
  391.         U16 title_icon,
  392.         U16 left_softkey,
  393.         U16 left_softkey_icon,
  394.         U16 right_softkey,
  395.         U16 right_softkey_icon,
  396.         UI_string_type message,
  397.         U8 *history_buffer)
  398. {
  399.     /*----------------------------------------------------------------*/
  400.     /* Local Variables                                                */
  401.     /*----------------------------------------------------------------*/
  402.     S32 l;
  403.     /*----------------------------------------------------------------*/
  404.     /* Code Body                                                      */
  405.     /*----------------------------------------------------------------*/
  406.     UI_UNUSED_PARAMETER(history_buffer);
  407.     gui_lock_double_buffer();
  408.     /* Leo start 20050809 */
  409.     entry_full_screen();
  410.     /* Leo end 20050809 */
  411.     change_left_softkey(left_softkey, left_softkey_icon);
  412.     change_right_softkey(right_softkey, right_softkey_icon);
  413.     SetupCategoryKeyHandlers();
  414.     if (title)
  415.     {
  416.         MMI_title_string = (UI_string_type) get_string(title);
  417.     }
  418.     else
  419.     {
  420.         MMI_title_string = NULL;
  421.     }
  422.     if (MMI_title_icon)
  423.     {
  424.         MMI_title_icon = (PU8) get_image(title_icon);
  425.     }
  426.     else
  427.     {
  428.         MMI_title_icon = NULL;
  429.     }
  430.     MMI_message_string = message;
  431.     l = gui_strlen(MMI_message_string);
  432.     create_multiline_inputbox_set_buffer(MMI_message_string, l, l, 0);
  433.     MMI_multiline_inputbox.flags |= UI_MULTI_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW
  434.         | UI_MULTI_LINE_INPUT_BOX_CENTER_JUSTIFY
  435.         | UI_MULTI_LINE_INPUT_BOX_DISABLE_BACKGROUND
  436.         | UI_MULTI_LINE_INPUT_BOX_DISABLE_SCROLLBAR | UI_MULTI_LINE_INPUT_BOX_VIEW_MODE;
  437.     MMI_multiline_inputbox.ext_flags |= GUI_MULTI_LINE_INPUT_BOX_TRUNCATE_CONTENT;
  438.     gui_unlock_double_buffer();
  439. }
  440. /*****************************************************************************
  441.  * FUNCTION
  442.  *  wgui_draw_pop_up_screen_background
  443.  * DESCRIPTION
  444.  *  draw the background of popup screns
  445.  * PARAMETERS
  446.  *  x1                      [IN]        Start x position
  447.  *  y1                      [IN]        Start y position
  448.  *  x2                      [IN]        End x position
  449.  *  y2                      [IN]        End y posityion
  450.  *  f                       [IN]        Filled pattern
  451.  *  enable_3D_effect        [IN]        
  452.  * RETURNS
  453.  *  void
  454.  *****************************************************************************/
  455. void wgui_draw_pop_up_screen_background(S32 x1, S32 y1, S32 x2, S32 y2, UI_filled_area *f, MMI_BOOL enable_3D_effect)
  456. {
  457. #ifdef __MMI_MAINLCD_240X320__
  458.     /*----------------------------------------------------------------*/
  459.     /* Local Variables                                                */
  460.     /*----------------------------------------------------------------*/
  461.     /* PMT HIMANSHU START 20050916 */
  462. #if 0
  463. /* under construction !*/
  464. /* under construction !*/
  465. /* under construction !*/
  466. /* under construction !*/
  467. /* under construction !*/
  468. #endif /* 0 */ 
  469.     /*----------------------------------------------------------------*/
  470.     /* Code Body                                                      */
  471.     /*----------------------------------------------------------------*/
  472.     if (enable_3D_effect == MMI_TRUE)
  473.     {
  474.         /* Doing nothing */
  475.     }
  476.     //gui_draw_gradient_rounded_rectangle(x1, y1, x2, y2, current_MMI_theme->scrollbar_indicator_filler->c, f->c, 6);
  477.     gui_draw_gradient_rounded_rectangle(x1, y1, x2, y2, f->border_color, f->c, 6);//091506 popup border
  478.     gui_fill_rectangle(x1 + 6, y1 + 6, x2 - 6, y2 - 6, f->c);
  479.     /* PMT HIMANSHU END 20050916 */
  480. #else /* __MMI_MAINLCD_240X320__ */ 
  481.     gui_fill_rectangle(x1 + 1, y1 + 7, x2 - 1, y2 - 7, f->c);
  482.     gui_draw_vertical_line(y1 + 6, y2 - 6, x1, f->border_color);
  483.     gui_draw_vertical_line(y1 + 6, y2 - 6, x2, f->border_color);
  484.     gui_draw_horizontal_line(x1 + 6, x2 - 6, y1, f->border_color);
  485.     gui_draw_horizontal_line(x1 + 6, x2 - 6, y2, f->border_color);
  486.     gui_draw_horizontal_line(x1 + 6, x2 - 6, y1 + 1, f->c);
  487.     gui_draw_horizontal_line(x1 + 4, x2 - 4, y1 + 2, f->c);
  488.     gui_draw_horizontal_line(x1 + 3, x2 - 3, y1 + 3, f->c);
  489.     gui_draw_horizontal_line(x1 + 2, x2 - 2, y1 + 4, f->c);
  490.     gui_draw_horizontal_line(x1 + 2, x2 - 2, y1 + 5, f->c);
  491.     gui_draw_horizontal_line(x1 + 1, x2 - 1, y1 + 6, f->c);
  492.     gui_draw_horizontal_line(x1 + 6, x2 - 6, y2 - 1, f->c);
  493.     gui_draw_horizontal_line(x1 + 4, x2 - 4, y2 - 2, f->c);
  494.     gui_draw_horizontal_line(x1 + 3, x2 - 3, y2 - 3, f->c);
  495.     gui_draw_horizontal_line(x1 + 2, x2 - 2, y2 - 4, f->c);
  496.     gui_draw_horizontal_line(x1 + 2, x2 - 2, y2 - 5, f->c);
  497.     gui_draw_horizontal_line(x1 + 1, x2 - 1, y2 - 6, f->c);
  498.     gui_putpixel(x1 + 5, y1 + 1, f->border_color);
  499.     gui_putpixel(x1 + 4, y1 + 1, f->border_color);
  500.     gui_putpixel(x1 + 3, y1 + 2, f->border_color);
  501.     gui_putpixel(x1 + 2, y1 + 3, f->border_color);
  502.     gui_putpixel(x1 + 1, y1 + 4, f->border_color);
  503.     gui_putpixel(x1 + 1, y1 + 5, f->border_color);
  504.     gui_putpixel(x2 - 5, y1 + 1, f->border_color);
  505.     gui_putpixel(x2 - 4, y1 + 1, f->border_color);
  506.     gui_putpixel(x2 - 3, y1 + 2, f->border_color);
  507.     gui_putpixel(x2 - 2, y1 + 3, f->border_color);
  508.     gui_putpixel(x2 - 1, y1 + 4, f->border_color);
  509.     gui_putpixel(x2 - 1, y1 + 5, f->border_color);
  510.     gui_putpixel(x1 + 5, y2 - 1, f->border_color);
  511.     gui_putpixel(x1 + 4, y2 - 1, f->border_color);
  512.     gui_putpixel(x1 + 3, y2 - 2, f->border_color);
  513.     gui_putpixel(x1 + 2, y2 - 3, f->border_color);
  514.     gui_putpixel(x1 + 1, y2 - 4, f->border_color);
  515.     gui_putpixel(x1 + 1, y2 - 5, f->border_color);
  516.     gui_putpixel(x2 - 5, y2 - 1, f->border_color);
  517.     gui_putpixel(x2 - 4, y2 - 1, f->border_color);
  518.     gui_putpixel(x2 - 3, y2 - 2, f->border_color);
  519.     gui_putpixel(x2 - 2, y2 - 3, f->border_color);
  520.     gui_putpixel(x2 - 1, y2 - 4, f->border_color);
  521.     gui_putpixel(x2 - 1, y2 - 5, f->border_color);
  522.     if (enable_3D_effect == MMI_TRUE)
  523.     {
  524.         gui_draw_horizontal_line(x1 + 7, x2 - 6, y2 + 1, f->border_color);
  525.         gui_draw_vertical_line(y1 + 7, y2 - 6, x2 + 1, f->border_color);
  526.         gui_putpixel(x2 - 5, y2, f->border_color);
  527.         gui_putpixel(x2 - 5, y2 + 1, f->border_color);
  528.         gui_putpixel(x2 - 4, y2, f->border_color);
  529.         gui_putpixel(x2 - 4, y2 + 1, f->border_color);
  530.         gui_putpixel(x2 - 3, y2, f->border_color);
  531.         gui_putpixel(x2 - 3, y2 - 1, f->border_color);
  532.         gui_putpixel(x2 - 2, y2 - 2, f->border_color);
  533.         gui_putpixel(x2 - 2, y2 - 1, f->border_color);
  534.         gui_putpixel(x2 - 1, y2 - 3, f->border_color);
  535.         gui_putpixel(x2 - 1, y2 - 2, f->border_color);
  536.         gui_putpixel(x2 - 0, y2 - 4, f->border_color);
  537.         gui_putpixel(x2 - 0, y2 - 3, f->border_color);
  538.         gui_putpixel(x2, y2 - 5, f->border_color);
  539.         gui_putpixel(x2 + 1, y2 - 5, f->border_color);
  540.         gui_putpixel(x2 + 1, y2 - 4, f->border_color);
  541.     }
  542. #endif /* __MMI_MAINLCD_240X320__ */ 
  543. }
  544. /*****************************************************************************
  545.  * FUNCTION
  546.  *  wgui_draw_pop_up_screen_background_style2
  547.  * DESCRIPTION
  548.  *  draw the background of popup screns
  549.  * PARAMETERS
  550.  *  x1          [IN]        Start x position
  551.  *  y1          [IN]        Start y position
  552.  *  x2          [IN]        End x position
  553.  *  y2          [IN]        End y posityion
  554.  *  f           [IN]        Filled pattern
  555.  *  top         [IN]        Whether to display top border
  556.  *  bottom      [IN]        Whether to display bottom border
  557.  *  left        [IN]        Whether to display left border
  558.  *  right       [IN]        Whether to display right border
  559.  * RETURNS
  560.  *  void
  561.  *****************************************************************************/
  562. void wgui_draw_pop_up_screen_background_style2(
  563.         S32 x1,
  564.         S32 y1,
  565.         S32 x2,
  566.         S32 y2,
  567.         UI_filled_area *f,
  568.         MMI_BOOL top,
  569.         MMI_BOOL bottom,
  570.         MMI_BOOL left,
  571.         MMI_BOOL right)
  572. {
  573.     /*----------------------------------------------------------------*/
  574.     /* Local Variables                                                */
  575.     /*----------------------------------------------------------------*/
  576.     S32 fy1, fy2, fx1, fx2;
  577.     /*----------------------------------------------------------------*/
  578.     /* Code Body                                                      */
  579.     /*----------------------------------------------------------------*/
  580.     if (top)
  581.     {
  582.         fy1 = y1 + 6;
  583.         gui_draw_horizontal_line(x1 + 6, x2 - 6, y1 + 1, f->c);
  584.         gui_draw_horizontal_line(x1 + 4, x2 - 4, y1 + 2, f->c);
  585.         gui_draw_horizontal_line(x1 + 3, x2 - 3, y1 + 3, f->c);
  586.         gui_draw_horizontal_line(x1 + 2, x2 - 2, y1 + 4, f->c);
  587.         gui_draw_horizontal_line(x1 + 2, x2 - 2, y1 + 5, f->c);
  588.         gui_draw_horizontal_line(x1 + 6, x2 - 6, y1, f->border_color);
  589.         gui_putpixel(x1 + 5, y1 + 1, f->border_color);
  590.         gui_putpixel(x1 + 4, y1 + 1, f->border_color);
  591.         gui_putpixel(x1 + 3, y1 + 2, f->border_color);
  592.         gui_putpixel(x1 + 2, y1 + 3, f->border_color);
  593.         gui_putpixel(x1 + 1, y1 + 4, f->border_color);
  594.         gui_putpixel(x1 + 1, y1 + 5, f->border_color);
  595.         gui_putpixel(x2 - 5, y1 + 1, f->border_color);
  596.         gui_putpixel(x2 - 4, y1 + 1, f->border_color);
  597.         gui_putpixel(x2 - 3, y1 + 2, f->border_color);
  598.         gui_putpixel(x2 - 2, y1 + 3, f->border_color);
  599.         gui_putpixel(x2 - 1, y1 + 4, f->border_color);
  600.         gui_putpixel(x2 - 1, y1 + 5, f->border_color);
  601.     }
  602.     else
  603.     {
  604.         fy1 = y1;
  605.     }
  606.     if (bottom)
  607.     {
  608.         fy2 = y2 - 6;
  609.         gui_draw_horizontal_line(x1 + 6, x2 - 6, y2 - 1, f->c);
  610.         gui_draw_horizontal_line(x1 + 4, x2 - 4, y2 - 2, f->c);
  611.         gui_draw_horizontal_line(x1 + 3, x2 - 3, y2 - 3, f->c);
  612.         gui_draw_horizontal_line(x1 + 2, x2 - 2, y2 - 4, f->c);
  613.         gui_draw_horizontal_line(x1 + 2, x2 - 2, y2 - 5, f->c);
  614.         gui_draw_horizontal_line(x1 + 6, x2 - 6, y2, f->border_color);
  615.         gui_putpixel(x1 + 5, y2 - 1, f->border_color);
  616.         gui_putpixel(x1 + 4, y2 - 1, f->border_color);
  617.         gui_putpixel(x1 + 3, y2 - 2, f->border_color);
  618.         gui_putpixel(x1 + 2, y2 - 3, f->border_color);
  619.         gui_putpixel(x1 + 1, y2 - 4, f->border_color);
  620.         gui_putpixel(x1 + 1, y2 - 5, f->border_color);
  621.         gui_putpixel(x2 - 5, y2 - 1, f->border_color);
  622.         gui_putpixel(x2 - 4, y2 - 1, f->border_color);
  623.         gui_putpixel(x2 - 3, y2 - 2, f->border_color);
  624.         gui_putpixel(x2 - 2, y2 - 3, f->border_color);
  625.         gui_putpixel(x2 - 1, y2 - 4, f->border_color);
  626.         gui_putpixel(x2 - 1, y2 - 5, f->border_color);
  627.     }
  628.     else
  629.     {
  630.         fy2 = y2;
  631.     }
  632.     if (left)
  633.     {
  634.         fx1 = x1 + 1;
  635.         gui_draw_vertical_line(fy1, fy2, x1, f->border_color);
  636.     }
  637.     else
  638.     {
  639.         fx1 = x1;
  640.     }
  641.     if (right)
  642.     {
  643.         fx2 = x2 - 1;
  644.         gui_draw_vertical_line(fy1, fy2, x2, f->border_color);
  645.     }
  646.     else
  647.     {
  648.         fx2 = x2;
  649.     }
  650.     gui_fill_rectangle(fx1, fy1, fx2, fy2, f->c);
  651. }
  652. extern void wgui_set_animation_image_y(S32 x, S32 y, PU8 img);
  653. /*****************************************************************************
  654.  * FUNCTION
  655.  *  ShowCategory62Screen
  656.  * DESCRIPTION
  657.  *  Displays the category62 screen
  658.  * PARAMETERS
  659.  *  message             [IN]        Message string
  660.  *  message_icon        [IN]        
  661.  *  history_buffer      [IN]        History buffer
  662.  *  MMI_ID_TYPE(?)      [IN]        Icon        Message icon
  663.  * RETURNS
  664.  *  void
  665.  *****************************************************************************/
  666. void ShowCategory62Screen(U16 message, U16 message_icon, U8 *history_buffer)
  667. {
  668.     /*----------------------------------------------------------------*/
  669.     /* Local Variables                                                */
  670.     /*----------------------------------------------------------------*/
  671.     dm_data_struct dm_data;
  672.     /*----------------------------------------------------------------*/
  673.     /* Code Body                                                      */
  674.     /*----------------------------------------------------------------*/
  675.     /* 053005 Calvin added */
  676. #ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
  677.     set_small_screen();
  678. #endif 
  679.     /* Calvin end */
  680.     ShowCommonCategoryPopupScreen(get_string(message), history_buffer);
  681.     ExitCategoryFunction = ExitCategory62Screen;
  682.     RedrawCategoryFunction = dm_redraw_category_screen;
  683.     GetCategoryHistory = dummy_get_history;
  684.     GetCategoryHistorySize = dummy_get_history_size;
  685.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  686.     dm_data.s32CatId = MMI_CATEGORY62_ID;
  687.     dm_data.s32flags = 0;
  688.     dm_setup_data(&dm_data);
  689.     if (message_icon)
  690.     {
  691.         dm_add_image(get_image(message_icon), NULL, NULL);
  692.     }
  693.     dm_redraw_category_screen();
  694. }
  695. /*****************************************************************************
  696.  * FUNCTION
  697.  *  ExitCategory62Screen
  698.  * DESCRIPTION
  699.  *  Exits the category62 screen
  700.  * PARAMETERS
  701.  *  void
  702.  * RETURNS
  703.  *  void
  704.  *****************************************************************************/
  705. void ExitCategory62Screen(void)
  706. {
  707.     /*----------------------------------------------------------------*/
  708.     /* Local Variables                                                */
  709.     /*----------------------------------------------------------------*/
  710.     /*----------------------------------------------------------------*/
  711.     /* Code Body                                                      */
  712.     /*----------------------------------------------------------------*/
  713.     /* 052405 Calvin added */
  714. #ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
  715.     reset_small_screen();
  716. #endif 
  717.     /* Calvin end */
  718.     gui_hide_animations();
  719.     ExitCategoryFunction = MMI_dummy_function;
  720.     RedrawCategoryFunction = MMI_dummy_function;
  721.     GetCategoryHistory = dummy_get_history;
  722.     GetCategoryHistorySize = dummy_get_history_size;
  723. }
  724. /*****************************************************************************
  725.  * FUNCTION
  726.  *  ShowCategory63Screen
  727.  * DESCRIPTION
  728.  *  Displays the category63 screen
  729.  * PARAMETERS
  730.  *  message             [IN]        Message string
  731.  *  message_icon        [IN]        
  732.  *  history_buffer      [IN]        History buffer
  733.  *  MMI_ID_TYPE(?)      [IN]        Icon        Message icon
  734.  * RETURNS
  735.  *  void
  736.  *****************************************************************************/
  737. void ShowCategory63Screen(U8 *message, U16 message_icon, U8 *history_buffer)
  738. {
  739.     /*----------------------------------------------------------------*/
  740.     /* Local Variables                                                */
  741.     /*----------------------------------------------------------------*/
  742.     dm_data_struct dm_data;
  743.     /*----------------------------------------------------------------*/
  744.     /* Code Body                                                      */
  745.     /*----------------------------------------------------------------*/
  746.     /* 053005 Calvin added */
  747. #ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
  748.     set_small_screen();
  749. #endif 
  750.     /* Calvin end */
  751.     ShowCommonCategoryPopupScreen((UI_string_type) message, history_buffer);
  752.     ExitCategoryFunction = ExitCategory62Screen;
  753.     RedrawCategoryFunction = dm_redraw_category_screen;
  754.     GetCategoryHistory = dummy_get_history;
  755.     GetCategoryHistorySize = dummy_get_history_size;
  756.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  757.     dm_data.s32CatId = MMI_CATEGORY62_ID;
  758.     dm_data.s32flags = 0;
  759.     dm_setup_data(&dm_data);
  760.     dm_add_image(get_image(message_icon), NULL, NULL);
  761.     dm_redraw_category_screen();
  762. }
  763. /*****************************************************************************
  764.  * FUNCTION
  765.  *  ShowCategory64Screen
  766.  * DESCRIPTION
  767.  *  Displays the category64 screen
  768.  * PARAMETERS
  769.  *  message             [IN]        Message string
  770.  *  message_icon        [IN]        
  771.  *  history_buffer      [IN]        History buffer
  772.  *  MMI_ID_TYPE(?)      [IN]        Icon        Message icon
  773.  * RETURNS
  774.  *  void
  775.  *****************************************************************************/
  776. void ShowCategory64Screen(U16 message, U16 message_icon, U8 *history_buffer)
  777. {
  778.     /*----------------------------------------------------------------*/
  779.     /* Local Variables                                                */
  780.     /*----------------------------------------------------------------*/
  781.     dm_data_struct dm_data;
  782.     /*----------------------------------------------------------------*/
  783.     /* Code Body                                                      */
  784.     /*----------------------------------------------------------------*/
  785.     /* 053005 Calvin added */
  786. #ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
  787.     set_small_screen();
  788. #endif 
  789.     /* Calvin end */
  790.     ShowCommonCategoryPopupScreen(get_string(message), history_buffer);
  791.     ExitCategoryFunction = ExitCategory62Screen;
  792.     RedrawCategoryFunction = dm_redraw_category_screen;
  793.     GetCategoryHistory = dummy_get_history;
  794.     GetCategoryHistorySize = dummy_get_history_size;
  795.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  796.     dm_data.s32CatId = MMI_CATEGORY64_ID;
  797.     dm_data.s32flags = 0;
  798.     dm_setup_data(&dm_data);
  799.     dm_add_image(get_image(message_icon), NULL, NULL);
  800.     dm_redraw_category_screen();
  801. }
  802. /* Leo start 20050722, pen down on image close popup */
  803. #if (defined __MMI_TOUCH_SCREEN__)
  804. /*****************************************************************************
  805.  * FUNCTION
  806.  *  Cat65ImagePenDownHdlr
  807.  * DESCRIPTION
  808.  *  
  809.  * PARAMETERS
  810.  *  point       [IN]        
  811.  * RETURNS
  812.  *  
  813.  *****************************************************************************/
  814. MMI_BOOL Cat65ImagePenDownHdlr(mmi_pen_point_struct point)
  815. {
  816.     /*----------------------------------------------------------------*/
  817.     /* Local Variables                                                */
  818.     /*----------------------------------------------------------------*/
  819.     /*----------------------------------------------------------------*/
  820.     /* Code Body                                                      */
  821.     /*----------------------------------------------------------------*/
  822.     if (PopupFunc == NULL)
  823.     {
  824.         PopupTimerFlagEnable();
  825.         PopupCloseByPressAnyKey();
  826.         return MMI_TRUE;
  827.     }
  828.     else
  829.     {
  830.         return MMI_FALSE;
  831.     }
  832. }
  833. #endif /* (defined __MMI_TOUCH_SCREEN__) */ 
  834. /* Len end 20050722 */
  835. /*****************************************************************************
  836.  * FUNCTION
  837.  *  ShowCategory65Screen
  838.  * DESCRIPTION
  839.  *  Displays the category65 screen
  840.  * PARAMETERS
  841.  *  message             [IN]        Message string
  842.  *  message_icon        [IN]        
  843.  *  history_buffer      [IN]        History buffer
  844.  *  MMI_ID_TYPE(?)      [IN]        Icon        Message icon
  845.  * RETURNS
  846.  *  void
  847.  *****************************************************************************/
  848. void ShowCategory65Screen(U8 *message, U16 message_icon, U8 *history_buffer)
  849. {
  850.     /*----------------------------------------------------------------*/
  851.     /* Local Variables                                                */
  852.     /*----------------------------------------------------------------*/
  853.     dm_data_struct dm_data;
  854.     /*----------------------------------------------------------------*/
  855.     /* Code Body                                                      */
  856.     /*----------------------------------------------------------------*/
  857.     /* 052405 Calvin added */
  858. #ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
  859.     set_small_screen();
  860. #endif 
  861.     /* Calvin end */
  862.     ShowCommonCategoryPopupScreen((UI_string_type) message, history_buffer);
  863. #ifdef __MMI_TOUCH_SCREEN__
  864.     wgui_register_category_screen_control_area_pen_handlers(Cat65ImagePenDownHdlr, MMI_PEN_EVENT_DOWN);
  865. #endif 
  866.     ExitCategoryFunction = ExitCategory62Screen;
  867.     RedrawCategoryFunction = dm_redraw_category_screen;
  868.     GetCategoryHistory = dummy_get_history;
  869.     GetCategoryHistorySize = dummy_get_history_size;
  870.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  871.     dm_data.s32CatId = MMI_CATEGORY64_ID;
  872.     dm_data.s32flags = 0;
  873.     dm_setup_data(&dm_data);
  874.     dm_add_image(get_image(message_icon), NULL, NULL);
  875.     dm_redraw_category_screen();
  876. }
  877. #if defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__)
  878. typedef struct
  879. {
  880.     S16 image_x;    /* left-top corner of image */
  881.     S16 image_y;
  882.     U16 image_id;
  883.     U16 state;
  884. } gui_calibration_screen_struct;
  885. static gui_calibration_screen_struct g_gui_calibration_screen_cntx;
  886. /*****************************************************************************
  887.  * FUNCTION
  888.  *  UpdateCalibrationScreen
  889.  * DESCRIPTION
  890.  *  Updates Multiline buffer contents before redrawing calibration setting screens.
  891.  * PARAMETERS
  892.  *  image_id        [IN]        
  893.  *  cali_x          [IN]        The position of central point of image (i.e. the calibration point)
  894.  *  cali_y          [IN]        
  895.  *  string          [IN]        
  896.  *  state           [IN]        Casted from PHNSET_CALIBRATION_STATE_ENUM
  897.  *  redraw          [IN]        Redraw the category screen
  898.  *  image(?)        [IN]        
  899.  * RETURNS
  900.  *  void
  901.  * REMARKS
  902.  *  We should avoid overlapping of image and text
  903.  *****************************************************************************/
  904. void UpdateCalibrationScreen(U16 image_id, S16 cali_x, S16 cali_y, U16 string, U16 state, BOOL redraw)
  905. {
  906.     /*----------------------------------------------------------------*/
  907.     /* Local Variables                                                */
  908.     /*----------------------------------------------------------------*/
  909.     S32 l, fh, image_width = 0, image_height = 0;
  910.     S32 yloc = 0;   /* start y coordinate *//* 111605 warning Calvin */
  911.     S32 maxht;      /* maximum height of Multiline Box */
  912.     S32 max_space;  /* max_space is the available height excluding the image */
  913.     PU8 image;
  914.     S32 image_x1, image_y1, image_x2, image_y2;
  915.     /*----------------------------------------------------------------*/
  916.     /* Code Body                                                      */
  917.     /*----------------------------------------------------------------*/
  918.     g_gui_calibration_screen_cntx.image_id = image_id;
  919.     g_gui_calibration_screen_cntx.state = state;
  920.     if (image_id)
  921.     {
  922.         image = get_image((MMI_ID_TYPE) image_id);
  923.         gui_measure_image(image, &image_width, &image_height);
  924.         image_x1 = g_gui_calibration_screen_cntx.image_x = (S16) (cali_x - (image_width >> 1));
  925.         image_y1 = g_gui_calibration_screen_cntx.image_y = (S16) (cali_y - (image_height >> 1));
  926.         image_x2 = image_x1 + image_width - 1;
  927.         image_y2 = image_x1 + image_height - 1;
  928.         MMI_DBG_ASSERT(image_x1 >= 0 && image_x2 < UI_device_width && image_y1 >= 0 && image_y2 < UI_device_height);
  929.     }
  930.     else
  931.     {
  932.         image = NULL;
  933.         image_x1 = image_y1 = image_x2 = image_y2 = 0;
  934.     }
  935.     /* Compute inputbox height */
  936.     MMI_message_string = (UI_string_type) GetString(string);
  937.     l = gui_strlen(MMI_message_string);
  938.     create_multiline_inputbox_set_buffer(MMI_message_string, l, l, 0);
  939.     MMI_multiline_inputbox.flags |= UI_MULTI_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW
  940.         | UI_MULTI_LINE_INPUT_BOX_CENTER_JUSTIFY
  941.         | UI_MULTI_LINE_INPUT_BOX_DISABLE_BACKGROUND
  942.         | UI_MULTI_LINE_INPUT_BOX_DISABLE_SCROLLBAR | UI_MULTI_LINE_INPUT_BOX_VIEW_MODE;
  943.     resize_multiline_inputbox(UI_device_width - 2, UI_device_height);
  944.     show_multiline_inputbox_no_draw();
  945.     fh = get_multiline_inputbox_line_height();
  946.     /* Move the inputbox to appropriate position */
  947. #ifdef __MMI_MAINLCD_128X128__
  948.     maxht = (MMI_multiline_inputbox.n_lines * fh) + MULTILINE_INPUTBOX_HEIGHT_PAD + MMI_multiline_inputbox.text_y + 10;
  949. #else 
  950.     maxht = (MMI_multiline_inputbox.n_lines * fh) + MULTILINE_INPUTBOX_HEIGHT_PAD + MMI_multiline_inputbox.text_y;
  951. #endif 
  952.     if (maxht > UI_device_height)
  953.     {
  954.         maxht = UI_device_height;
  955.     }
  956.     switch (state)
  957.     {
  958.         case CALIBRATION_WELCOME_STATE:
  959.             yloc = (UI_device_height >> 1) - (maxht >> 1);
  960.             break;
  961.         case CALIBRATION_TOP_LEFT_POINT_STATE:
  962.             max_space = UI_device_height - image_y2 - 1;
  963.             if (maxht > max_space)
  964.             {
  965.                 yloc = image_y2 + 1;
  966.                 maxht = max_space;
  967.             }
  968.             else
  969.             {
  970.                 yloc = image_y2 + 1 + (max_space - maxht) / 3;
  971.             }
  972.             break;
  973.         case CALIBRATION_CENTER_POINT_STATE:
  974.             max_space = image_y1 - 1;
  975.             if (maxht > max_space)
  976.             {
  977.                 yloc = 0;
  978.                 maxht = max_space;
  979.             }
  980.             else
  981.             {
  982.                 yloc = (max_space >> 1) - (maxht >> 1);
  983.             }
  984.             break;
  985.         case CALIBRATION_BOTTOM_RIGHT_POINT_STATE:
  986.             max_space = image_y1 - 1;
  987.             if (maxht > max_space)
  988.             {
  989.                 yloc = 0;
  990.                 maxht = max_space;
  991.             }
  992.             else
  993.             {
  994.                 yloc = (max_space - maxht) * 2 / 3;
  995.             }
  996.             break;
  997.         default:
  998.             MMI_ASSERT(0);
  999.             break;
  1000.     }
  1001.     resize_multiline_inputbox(UI_device_width - 2, maxht);
  1002.     move_multiline_inputbox(1, yloc);
  1003.     if (redraw)
  1004.     {
  1005.         RedrawCalibrationScreen();
  1006.     }
  1007. }
  1008. /*****************************************************************************
  1009.  * FUNCTION
  1010.  *  ExitCalibrationScreen
  1011.  * DESCRIPTION
  1012.  *  Exits Calibration Screen
  1013.  * PARAMETERS
  1014.  *  void
  1015.  * RETURNS
  1016.  *  void
  1017.  *****************************************************************************/
  1018. void ExitCalibrationScreen(void)
  1019. {
  1020.     /*----------------------------------------------------------------*/
  1021.     /* Local Variables                                                */
  1022.     /*----------------------------------------------------------------*/
  1023.     /*----------------------------------------------------------------*/
  1024.     /* Code Body                                                      */
  1025.     /*----------------------------------------------------------------*/
  1026.     gui_hide_animations();
  1027.     ExitCategoryFunction = MMI_dummy_function;
  1028.     RedrawCategoryFunction = MMI_dummy_function;
  1029.     GetCategoryHistory = dummy_get_history;
  1030.     GetCategoryHistorySize = dummy_get_history_size;
  1031. }
  1032. /*****************************************************************************
  1033.  * FUNCTION
  1034.  *  RedrawCalibrationScreen
  1035.  * DESCRIPTION
  1036.  *  Redraws Calibration Screen
  1037.  * PARAMETERS
  1038.  *  void
  1039.  * RETURNS
  1040.  *  void
  1041.  *****************************************************************************/
  1042. void RedrawCalibrationScreen(void)
  1043. {
  1044.     /*----------------------------------------------------------------*/
  1045.     /* Local Variables                                                */
  1046.     /*----------------------------------------------------------------*/
  1047.     PU8 image = NULL;
  1048.     gdi_handle handle;
  1049.     /*----------------------------------------------------------------*/
  1050.     /* Code Body                                                      */
  1051.     /*----------------------------------------------------------------*/
  1052.     gui_lock_double_buffer();
  1053.     gui_hide_animations();
  1054.     if (g_gui_calibration_screen_cntx.image_id)
  1055.     {
  1056.         image = get_image((MMI_ID_TYPE) g_gui_calibration_screen_cntx.image_id);
  1057.     }
  1058.     gui_push_clip();
  1059.     gui_reset_clip();
  1060.     clear_screen();
  1061.     show_multiline_inputbox();
  1062.     gui_reset_clip();
  1063.     if (image)
  1064.     {
  1065.         gdi_image_draw_animation(
  1066.             g_gui_calibration_screen_cntx.image_x,
  1067.             g_gui_calibration_screen_cntx.image_y,
  1068.             image,
  1069.             (gdi_handle*) & handle);
  1070.     }
  1071.     gui_pop_clip();
  1072.     gui_unlock_double_buffer();
  1073.     gui_BLT_double_buffer(0, 0, UI_device_width - 1, UI_device_height - 1);
  1074. }
  1075. /*****************************************************************************
  1076.  * FUNCTION
  1077.  *  ShowCalibrationScreen
  1078.  * DESCRIPTION
  1079.  *  Shows Calibration Screen
  1080.  * PARAMETERS
  1081.  *  image_id        [IN]        
  1082.  *  cali_x          [IN]        
  1083.  *  cali_y          [IN]        
  1084.  *  string          [IN]        
  1085.  *  state           [IN]        
  1086.  *  image(?)        [IN]        
  1087.  * RETURNS
  1088.  *  void
  1089.  *****************************************************************************/
  1090. void ShowCalibrationScreen(U16 image_id, S16 cali_x, S16 cali_y, U16 string, U16 state)
  1091. {
  1092.     /*----------------------------------------------------------------*/
  1093.     /* Local Variables                                                */
  1094.     /*----------------------------------------------------------------*/
  1095.     /*----------------------------------------------------------------*/
  1096.     /* Code Body                                                      */
  1097.     /*----------------------------------------------------------------*/
  1098.     entry_full_screen();
  1099.     MMI_menu_shortcut_number = -1;
  1100.     gui_lock_double_buffer();
  1101.     clear_category_screen_key_handlers();
  1102.     clear_left_softkey();
  1103.     clear_right_softkey();
  1104.     UpdateCalibrationScreen(image_id, cali_x, cali_y, string, state, MMI_FALSE);
  1105.     gui_unlock_double_buffer();
  1106.     ExitCategoryFunction = ExitCalibrationScreen;
  1107.     RedrawCategoryFunction = RedrawCalibrationScreen;
  1108.     GetCategoryHistory = dummy_get_history;
  1109.     GetCategoryHistorySize = dummy_get_history_size;
  1110.     RedrawCalibrationScreen();
  1111. }
  1112. #ifdef __MMI_HANDWRITING_PAD__
  1113. static U8 g_gui_control_area[TP_AREA_MAX_NUM];
  1114. /*****************************************************************************
  1115.  * FUNCTION
  1116.  *  UpdateTestControlAreaScreen
  1117.  * DESCRIPTION
  1118.  *  Updates Multiline buffer contents before redrawing test control area screens.
  1119.  * PARAMETERS
  1120.  *  pos         [IN]        The position of the click point
  1121.  *  string      [IN]        
  1122.  *  state       [IN]        Casted from PHNSET_CALIBRATION_STATE_ENUM
  1123.  *  redraw      [IN]        Redraw the category screen
  1124.  * RETURNS
  1125.  *  the state in testing control area screen
  1126.  * REMARKS
  1127.  *  We should avoid overlapping of image and text
  1128.  *****************************************************************************/
  1129. U16 UpdateTestControlAreaScreen(mmi_pen_point_struct pos, U16 string, U16 state, BOOL redraw)
  1130. {
  1131.     /*----------------------------------------------------------------*/
  1132.     /* Local Variables                                                */
  1133.     /*----------------------------------------------------------------*/
  1134.     S32 l, fh;
  1135.     S32 yloc;   /* start y coordinate */
  1136.     S32 maxht;  /* maximum height of Multiline Box */
  1137.     /*----------------------------------------------------------------*/
  1138.     /* Code Body                                                      */
  1139.     /*----------------------------------------------------------------*/
  1140.     /* Compute inputbox height */
  1141.     MMI_message_string = (UI_string_type) GetString(string);
  1142.     l = gui_strlen(MMI_message_string);
  1143.     create_multiline_inputbox_set_buffer(MMI_message_string, l, l, 0);
  1144.     MMI_multiline_inputbox.flags |= UI_MULTI_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW
  1145.         | UI_MULTI_LINE_INPUT_BOX_CENTER_JUSTIFY
  1146.         | UI_MULTI_LINE_INPUT_BOX_DISABLE_BACKGROUND
  1147.         | UI_MULTI_LINE_INPUT_BOX_DISABLE_SCROLLBAR | UI_MULTI_LINE_INPUT_BOX_VIEW_MODE;
  1148.     resize_multiline_inputbox(UI_device_width - 2, UI_device_height);
  1149.     show_multiline_inputbox_no_draw();
  1150.     fh = get_multiline_inputbox_line_height();
  1151.     /* Move the inputbox to appropriate position */
  1152. #ifdef __MMI_UI_STYLE_1__
  1153.     maxht = (MMI_multiline_inputbox.n_lines * fh) + MULTILINE_INPUTBOX_HEIGHT_PAD + MMI_multiline_inputbox.text_y + 10;
  1154. #else 
  1155.     maxht = (MMI_multiline_inputbox.n_lines * fh) + MULTILINE_INPUTBOX_HEIGHT_PAD + MMI_multiline_inputbox.text_y;
  1156. #endif 
  1157.     if (maxht > UI_device_height)
  1158.     {
  1159.         maxht = UI_device_height;
  1160.     }
  1161.     switch (state)
  1162.     {
  1163.         case TEST_CONTROL_AREA_WELCOME_STATE:
  1164.             memset(g_gui_control_area, 0, sizeof(U8) * TP_AREA_MAX_NUM);
  1165.             yloc = 20;  /* (UI_device_height>>1) - (maxht >> 1); */
  1166.             state = TEST_CONTROL_AREA_TESTING_STATE;
  1167.             break;
  1168.         case TEST_CONTROL_AREA_TESTING_STATE:
  1169.         {
  1170.             S32 i;
  1171.             yloc = 20;  /* (UI_device_height>>1) - (maxht >> 1); */
  1172.             if ((i = mmi_pen_check_inside_control_area(pos)) >= 0)
  1173.             {
  1174.                 g_gui_control_area[i] = MMI_TRUE;
  1175.             }
  1176.             state = TEST_CONTROL_AREA_FINISH_STATE;
  1177.             for (i = 0; i < TP_AREA_MAX_NUM; i++)
  1178.             {
  1179.                 if (IS_ENABLE_FLAG(tp_area_table[i].flag, TP_CONTROL_AREA) && (g_gui_control_area[i] != MMI_TRUE))
  1180.                 {
  1181.                     state = TEST_CONTROL_AREA_TESTING_STATE;
  1182.                     break;
  1183.                 }
  1184.             }
  1185.         }
  1186.             break;
  1187.         default:
  1188.             MMI_ASSERT(0);
  1189.             state = TEST_CONTROL_AREA_WELCOME_STATE;
  1190.             break;
  1191.     }
  1192.     resize_multiline_inputbox(UI_device_width - 2, maxht);
  1193.     move_multiline_inputbox(1, yloc);
  1194.     if (redraw)
  1195.     {
  1196.         RedrawTestControlAreaScreen();
  1197.     }
  1198.     return state;
  1199. }
  1200. /*****************************************************************************
  1201.  * FUNCTION
  1202.  *  ExitTestControlAreaScreen
  1203.  * DESCRIPTION
  1204.  *  Exits Control Area Screen
  1205.  * PARAMETERS
  1206.  *  void
  1207.  * RETURNS
  1208.  *  void
  1209.  *****************************************************************************/
  1210. void ExitTestControlAreaScreen(void)
  1211. {
  1212.     /*----------------------------------------------------------------*/
  1213.     /* Local Variables                                                */
  1214.     /*----------------------------------------------------------------*/
  1215.     /*----------------------------------------------------------------*/
  1216.     /* Code Body                                                      */
  1217.     /*----------------------------------------------------------------*/
  1218.     ExitCategoryFunction = MMI_dummy_function;
  1219.     RedrawCategoryFunction = MMI_dummy_function;
  1220.     GetCategoryHistory = dummy_get_history;
  1221.     GetCategoryHistorySize = dummy_get_history_size;
  1222. }
  1223. /*****************************************************************************
  1224.  * FUNCTION
  1225.  *  RedrawTestControlAreaScreen
  1226.  * DESCRIPTION
  1227.  *  Redraws Control Area Screen
  1228.  * PARAMETERS
  1229.  *  void
  1230.  * RETURNS
  1231.  *  void
  1232.  *****************************************************************************/
  1233. void RedrawTestControlAreaScreen(void)
  1234. {
  1235.     /*----------------------------------------------------------------*/
  1236.     /* Local Variables                                                */
  1237.     /*----------------------------------------------------------------*/
  1238.     int i;
  1239.     /*----------------------------------------------------------------*/
  1240.     /* Code Body                                                      */
  1241.     /*----------------------------------------------------------------*/
  1242.     /* gdi_color color[] = {GDI_COLOR_BLACK, GDI_COLOR_GREEN, GDI_COLOR_GRAY, GDI_COLOR_RED, GDI_COLOR_GREEN }; */
  1243.     gui_lock_double_buffer();
  1244.     gui_push_clip();
  1245.     gui_reset_clip();
  1246.     clear_screen();
  1247.     show_multiline_inputbox();
  1248.     gui_reset_clip();
  1249.     for (i = 0; i < TP_AREA_MAX_NUM; i++)
  1250.     {
  1251.         if (IS_ENABLE_FLAG(tp_area_table[i].flag, TP_CONTROL_AREA) && (g_gui_control_area[i] != MMI_TRUE))
  1252.         {
  1253.             int index = 0;
  1254.             mmi_pen_point_struct pos1, pos2;
  1255.             pos1 = tp_area_table[i].pos[index];
  1256.             index++;
  1257.             while ((tp_area_table[i].pos[index].x != -1) && (tp_area_table[i].pos[index].y != -1))
  1258.             {
  1259.                 pos2 = tp_area_table[i].pos[index];
  1260.                 gdi_draw_line(pos1.x, pos1.y, pos2.x, pos2.y, GDI_COLOR_BLACK);
  1261.                 pos1 = pos2;
  1262.                 index++;
  1263.             }
  1264.             pos2 = tp_area_table[i].pos[0];
  1265.             gdi_draw_line(pos1.x, pos1.y, pos2.x, pos2.y, GDI_COLOR_BLACK);
  1266.         }
  1267.         else
  1268.         {
  1269.             /* handwriting area */
  1270.         }
  1271.     }
  1272.     gui_pop_clip();
  1273.     gui_unlock_double_buffer();
  1274.     gui_BLT_double_buffer(0, 0, UI_device_width - 1, UI_device_height - 1);
  1275. }
  1276. /*****************************************************************************
  1277.  * FUNCTION
  1278.  *  ShowTestControlAreaScreen
  1279.  * DESCRIPTION
  1280.  *  Shows Control Area Screen
  1281.  * PARAMETERS
  1282.  *  pos         [IN]        
  1283.  *  string      [IN]        
  1284.  *  state       [IN]        
  1285.  * RETURNS
  1286.  *  void
  1287.  *****************************************************************************/
  1288. void ShowTestControlAreaScreen(mmi_pen_point_struct pos, U16 string, U16 state)
  1289. {
  1290.     /*----------------------------------------------------------------*/
  1291.     /* Local Variables                                                */
  1292.     /*----------------------------------------------------------------*/
  1293.     /*----------------------------------------------------------------*/
  1294.     /* Code Body                                                      */
  1295.     /*----------------------------------------------------------------*/
  1296.     entry_full_screen();
  1297.     MMI_menu_shortcut_number = -1;
  1298.     gui_lock_double_buffer();
  1299.     clear_category_screen_key_handlers();
  1300.     clear_left_softkey();
  1301.     clear_right_softkey();
  1302.     UpdateTestControlAreaScreen(pos, string, state, MMI_FALSE);
  1303.     gui_unlock_double_buffer();
  1304.     ExitCategoryFunction = ExitTestControlAreaScreen;
  1305.     RedrawCategoryFunction = RedrawTestControlAreaScreen;
  1306.     GetCategoryHistory = dummy_get_history;
  1307.     GetCategoryHistorySize = dummy_get_history_size;
  1308.     RedrawTestControlAreaScreen();
  1309. }
  1310. #endif /* __MMI_HANDWRITING_PAD__ */ 
  1311. #endif /* defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__) */ 
  1312. /** Slide 32 ***/
  1313. /*****************************************************************************
  1314.  * FUNCTION
  1315.  *  ExitCategory121Screen
  1316.  * DESCRIPTION
  1317.  *  Exits the category121 screen
  1318.  * PARAMETERS
  1319.  *  void
  1320.  * RETURNS
  1321.  *  void
  1322.  *****************************************************************************/
  1323. void ExitCategory121Screen(void)
  1324. {
  1325.     /*----------------------------------------------------------------*/
  1326.     /* Local Variables                                                */
  1327.     /*----------------------------------------------------------------*/
  1328.     /*----------------------------------------------------------------*/
  1329.     /* Code Body                                                      */
  1330.     /*----------------------------------------------------------------*/
  1331. #ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
  1332.     reset_small_screen();
  1333. #endif 
  1334.     close_status_icons();
  1335.     reset_softkeys();
  1336.     reset_multiline_inputbox();
  1337.     gui_hide_animations();
  1338.     ExitCategoryFunction = MMI_dummy_function;
  1339.     RedrawCategoryFunction = MMI_dummy_function;
  1340.     GetCategoryHistory = dummy_get_history;
  1341.     GetCategoryHistorySize = dummy_get_history_size;
  1342. }
  1343. extern void wgui_set_animation_y(S32 x, S32 y, MMI_ID_TYPE img);
  1344. /*****************************************************************************
  1345.  * FUNCTION
  1346.  *  ShowCategory121Screen
  1347.  * DESCRIPTION
  1348.  *  Displays the category121 screen
  1349.  * PARAMETERS
  1350.  *  left_softkey            [IN]        Left softkey label
  1351.  *  left_softkey_icon       [IN]        Icon for the right softkey
  1352.  *  right_softkey           [IN]        Right softkey label
  1353.  *  right_softkey_icon      [IN]        
  1354.  *  message                 [IN]        String to display
  1355.  *  message_icon            [IN]        Icon to display
  1356.  *  history_buffer          [IN]        History buffer
  1357.  *  flag                    [IN]        Value shpuld be 0/1 -
  1358.  *  no(?)                   [IN]        Border drawn
  1359.  *  border(?)               [IN]        Around image and text
  1360.  * RETURNS
  1361.  *  void
  1362.  *****************************************************************************/
  1363. void ShowCategory121Screen(
  1364.         U16 left_softkey,
  1365.         U16 left_softkey_icon,
  1366.         U16 right_softkey,
  1367.         U16 right_softkey_icon,
  1368.         U8 *message,
  1369.         U16 message_icon,
  1370.         U8 *history_buffer,
  1371.         U8 flag)
  1372. {
  1373.     /*----------------------------------------------------------------*/
  1374.     /* Local Variables                                                */
  1375.     /*----------------------------------------------------------------*/
  1376.     dm_data_struct dm_data;
  1377.     /*----------------------------------------------------------------*/
  1378.     /* Code Body                                                      */
  1379.     /*----------------------------------------------------------------*/
  1380. #ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
  1381.     set_small_screen();
  1382. #endif 
  1383.     ShowCommonCategoryPopupScreenType2(
  1384.         0,
  1385.         0,
  1386.         left_softkey,
  1387.         left_softkey_icon,
  1388.         right_softkey,
  1389.         right_softkey_icon,
  1390.         (UI_string_type) message,
  1391.         history_buffer);
  1392. #ifndef __MMI_UI_SMALL_SCREEN_SUPPORT__
  1393.     ShowStatusIconsTitle();
  1394. #endif 
  1395.     ExitCategoryFunction = ExitCategory121Screen;
  1396.     RedrawCategoryFunction = dm_redraw_category_screen;
  1397.     GetCategoryHistory = dummy_get_history;
  1398.     GetCategoryHistorySize = dummy_get_history_size;
  1399.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  1400.     dm_data.s32CatId = MMI_CATEGORY121_ID;
  1401. #ifndef __MMI_UI_SMALL_SCREEN_SUPPORT__
  1402.     dm_data.s32flags = DM_CLEAR_SCREEN_BACKGROUND | DM_NO_TITLE;
  1403. #else 
  1404.     dm_data.s32flags = DM_NO_TITLE | DM_NO_STATUS_BAR;
  1405. #endif 
  1406.     if (flag == 0)
  1407.     {
  1408.         dm_data.s32flags |= DM_NO_POPUP_BACKGROUND;
  1409.     }
  1410.     dm_setup_data(&dm_data);
  1411.     dm_add_image(get_image(message_icon), NULL, NULL);
  1412.     dm_redraw_category_screen();
  1413. }
  1414. /** Slide 56,57 ****/
  1415. /*****************************************************************************
  1416.  * FUNCTION
  1417.  *  Cate123CategoryControlAreaPenDownHandler
  1418.  * DESCRIPTION
  1419.  *  Category 123 control area pen down event handler
  1420.  * PARAMETERS
  1421.  *  point       [IN]        
  1422.  * RETURNS
  1423.  *  MMI_BOOL
  1424.  *****************************************************************************/
  1425. /* diamond, 2006/01/16 Category 123 control area pen down event handler */
  1426. #if (defined __MMI_TOUCH_SCREEN__)
  1427. MMI_BOOL Cate123CategoryControlAreaPenDownHandler(mmi_pen_point_struct point)
  1428. {
  1429.     /*----------------------------------------------------------------*/
  1430.     /* Local Variables                                                */
  1431.     /*----------------------------------------------------------------*/
  1432.     /*----------------------------------------------------------------*/
  1433.     /* Code Body                                                      */
  1434.     /*----------------------------------------------------------------*/
  1435.     mmi_idle_restart_keypad_lock_timer();
  1436.     return MMI_TRUE;
  1437. }
  1438. #endif /* (defined __MMI_TOUCH_SCREEN__) */ 
  1439. /*****************************************************************************
  1440.  * FUNCTION
  1441.  *  ShowCategory123Screen
  1442.  * DESCRIPTION
  1443.  *  Displays the category123 screen with status bar at the top
  1444.  * PARAMETERS
  1445.  *  title                   [IN]        =0 and title_icon=0, then status bar is displayed instead of the title
  1446.  *  title_icon              [IN]        
  1447.  *  left_softkey            [IN]        Left softkey label
  1448.  *  left_softkey_icon       [IN]        Icon for the left softkey
  1449.  *  right_softkey           [IN]        Right softkey label
  1450.  *  right_softkey_icon      [IN]        Icon for the right softkey
  1451.  *  message                 [IN]        Notification message
  1452.  *  message_icon            [IN]        
  1453.  *  history_buffer          [IN]        History buffer
  1454.  *  MMI_ID_TYPE(?)          [IN]        Image          Notification image
  1455.  *  For(?)                  [IN]        Other values, a title is displayed
  1456.  * RETURNS
  1457.  *  void
  1458.  *****************************************************************************/
  1459. void ShowCategory123Screen(
  1460.         U16 title,
  1461.         U16 title_icon,
  1462.         U16 left_softkey,
  1463.         U16 left_softkey_icon,
  1464.         U16 right_softkey,
  1465.         U16 right_softkey_icon,
  1466.         U16 message,
  1467.         U16 message_icon,
  1468.         U8 *history_buffer)
  1469. {
  1470.     /*----------------------------------------------------------------*/
  1471.     /* Local Variables                                                */
  1472.     /*----------------------------------------------------------------*/
  1473.     dm_data_struct dm_data;
  1474.     /*----------------------------------------------------------------*/
  1475.     /* Code Body                                                      */
  1476.     /*----------------------------------------------------------------*/
  1477.     /* 053005 Calvin added */
  1478. #ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
  1479.     set_small_screen();
  1480. #endif 
  1481.     /* Calvin end */
  1482.     ShowCommonCategoryPopupScreenType2(
  1483.         title,
  1484.         title_icon,
  1485.         left_softkey,
  1486.         left_softkey_icon,
  1487.         right_softkey,
  1488.         right_softkey_icon,
  1489.         get_string(message),
  1490.         history_buffer);
  1491. #if (defined __MMI_TOUCH_SCREEN__)
  1492.     wgui_register_category_screen_control_area_pen_handlers(
  1493.         Cate123CategoryControlAreaPenDownHandler,
  1494.         MMI_PEN_EVENT_DOWN);
  1495. #endif /* (defined __MMI_TOUCH_SCREEN__) */ 
  1496.     ExitCategoryFunction = ExitCategory121Screen;
  1497.     RedrawCategoryFunction = dm_redraw_category_screen;
  1498.     GetCategoryHistory = dummy_get_history;
  1499.     GetCategoryHistorySize = dummy_get_history_size;
  1500.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  1501.     dm_data.s32CatId = MMI_CATEGORY123_ID;
  1502.     dm_data.s32flags = DM_CLEAR_SCREEN_BACKGROUND;
  1503.     if ((title == 0) && (title_icon == 0))
  1504.     {
  1505.         dm_data.s32flags |= DM_NO_TITLE;
  1506.         ShowStatusIconsTitle();
  1507.     }
  1508.     else if (!((title == 0xffff) && (title_icon == 0xffff)))
  1509.     {
  1510.     #if !defined(__MMI_MAINLCD_176X220__) && !defined (__MMI_MAINLCD_240X320__)     /* 041205 Calvin modieid */
  1511.         dm_data.s32flags |= DM_NO_STATUS_BAR;
  1512.     #endif 
  1513.     }
  1514.     else
  1515.     {
  1516.     #if !defined(__MMI_MAINLCD_176X220__) && !defined (__MMI_MAINLCD_240X320__)     /* 041205 Calvin modieid */
  1517.         dm_data.s32flags |= DM_NO_STATUS_BAR | DM_NO_TITLE;
  1518.     #else /* !defined(__MMI_MAINLCD_176X220__) && !defined (__MMI_MAINLCD_240X320__) */ 
  1519.         {
  1520.             dm_data.s32flags |= DM_NO_TITLE;
  1521.             ShowStatusIconsTitle();
  1522.         }
  1523.     #endif /* !defined(__MMI_MAINLCD_176X220__) && !defined (__MMI_MAINLCD_240X320__) */ 
  1524.     }
  1525.     dm_setup_data(&dm_data);
  1526.     dm_add_image(get_image(message_icon), NULL, NULL);
  1527.     dm_redraw_category_screen();
  1528. }
  1529. /** Slide 56,57: Dynamic version of 123 ****/
  1530. /*****************************************************************************
  1531.  * FUNCTION
  1532.  *  ShowCategory124Screen
  1533.  * DESCRIPTION
  1534.  *  Displays the category124 screen with status bar at the top
  1535.  * PARAMETERS
  1536.  *  title                   [IN]        =0 and title_icon=0, then status bar is displayed instead of the title
  1537.  *  title_icon              [IN]        
  1538.  *  left_softkey            [IN]        Left softkey label
  1539.  *  left_softkey_icon       [IN]        Icon for the left softkey
  1540.  *  right_softkey           [IN]        Right softkey label
  1541.  *  right_softkey_icon      [IN]        Icon for the right softkey
  1542.  *  message                 [IN]        Notification message
  1543.  *  message_icon            [IN]        
  1544.  *  history_buffer          [IN]        History buffer
  1545.  *  MMI_ID_TYPE(?)          [IN]        Image          Notification image
  1546.  *  For(?)                  [IN]        Other values, a title is displayed
  1547.  * RETURNS
  1548.  *  void
  1549.  *****************************************************************************/
  1550. void ShowCategory124Screen(
  1551.         U16 title,
  1552.         U16 title_icon,
  1553.         U16 left_softkey,
  1554.         U16 left_softkey_icon,
  1555.         U16 right_softkey,
  1556.         U16 right_softkey_icon,
  1557.         U8 *message,
  1558.         U16 message_icon,
  1559.         U8 *history_buffer)
  1560. {
  1561.     /*----------------------------------------------------------------*/
  1562.     /* Local Variables                                                */
  1563.     /*----------------------------------------------------------------*/
  1564.     dm_data_struct dm_data;
  1565.     /*----------------------------------------------------------------*/
  1566.     /* Code Body                                                      */
  1567.     /*----------------------------------------------------------------*/
  1568.     /* 053005 Calvin added */
  1569. #ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
  1570.     set_small_screen();
  1571. #endif 
  1572.     /* Calvin end */
  1573.     ShowCommonCategoryPopupScreenType2(
  1574.         title,
  1575.         title_icon,
  1576.         left_softkey,
  1577.         left_softkey_icon,
  1578.         right_softkey,
  1579.         right_softkey_icon,
  1580.         (UI_string_type) message,
  1581.         history_buffer);
  1582.     ExitCategoryFunction = ExitCategory121Screen;
  1583.     RedrawCategoryFunction = dm_redraw_category_screen;
  1584.     GetCategoryHistory = dummy_get_history;
  1585.     GetCategoryHistorySize = dummy_get_history_size;
  1586.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  1587.     dm_data.s32CatId = MMI_CATEGORY123_ID;
  1588.     dm_data.s32flags = 0;
  1589.     if ((title == 0) && (title_icon == 0))
  1590.     {
  1591.         dm_data.s32flags |= DM_NO_TITLE;
  1592.         ShowStatusIconsTitle();
  1593.     }
  1594.     else if (!((title == 0xffff) && (title_icon == 0xffff)))
  1595.     {
  1596.     #if !defined(__MMI_MAINLCD_176X220__) && !defined (__MMI_MAINLCD_240X320__)     /* 041205 Calvin modieid */
  1597.         dm_data.s32flags |= DM_NO_STATUS_BAR;
  1598.     #endif 
  1599.     }
  1600.     else
  1601.     {
  1602.     #if !defined(__MMI_MAINLCD_176X220__) && !defined (__MMI_MAINLCD_240X320__)     /* 041205 Calvin modieid */
  1603.         dm_data.s32flags |= DM_NO_STATUS_BAR | DM_NO_TITLE;
  1604.     #else /* !defined(__MMI_MAINLCD_176X220__) && !defined (__MMI_MAINLCD_240X320__) */ 
  1605.         {
  1606.             dm_data.s32flags |= DM_NO_TITLE;
  1607.             ShowStatusIconsTitle();
  1608.         }
  1609.     #endif /* !defined(__MMI_MAINLCD_176X220__) && !defined (__MMI_MAINLCD_240X320__) */ 
  1610.     }
  1611.     dm_setup_data(&dm_data);
  1612.     dm_add_image(get_image(message_icon), NULL, NULL);
  1613.     dm_redraw_category_screen();
  1614. }
  1615. /*****************************************************************************
  1616.  * FUNCTION
  1617.  *  ExitCategory151Screen
  1618.  * DESCRIPTION
  1619.  *  Exits the category151 screen
  1620.  * PARAMETERS
  1621.  *  void
  1622.  * RETURNS
  1623.  *  void
  1624.  *****************************************************************************/
  1625. void ExitCategory151Screen(void)
  1626. {
  1627.     /*----------------------------------------------------------------*/
  1628.     /* Local Variables                                                */
  1629.     /*----------------------------------------------------------------*/
  1630.     /*----------------------------------------------------------------*/
  1631.     /* Code Body                                                      */
  1632.     /*----------------------------------------------------------------*/
  1633.     /* 053005 Calvin added */
  1634.     //#ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
  1635.     //   reset_small_screen();
  1636.     //#endif
  1637.     /* Calvin end */
  1638.     MMI_multiline_inputbox.normal_filler = current_UI_theme->multi_line_input_box_theme->normal_filler;
  1639.     gui_hide_animations();
  1640.     reset_softkeys();
  1641.     close_status_icons();
  1642.     reset_multiline_inputbox();
  1643.     ExitCategoryFunction = MMI_dummy_function;
  1644.     RedrawCategoryFunction = MMI_dummy_function;
  1645.     GetCategoryHistory = dummy_get_history;
  1646.     GetCategoryHistorySize = dummy_get_history_size;
  1647. #if defined(__MMI_MAINLCD_176X220__) || defined (__MMI_MAINLCD_240X320__)       /* 041205 Calvin modieid */
  1648.     leave_full_screen();
  1649. #endif 
  1650. }
  1651. /*****************************************************************************
  1652.  * FUNCTION
  1653.  *  category151_keyboard_handler
  1654.  * DESCRIPTION
  1655.  *  set category151 key board handlres
  1656.  * PARAMETERS
  1657.  *  vkey_code       [IN]        
  1658.  *  key_state       [IN]        
  1659.  * RETURNS
  1660.  *  void
  1661.  *****************************************************************************/
  1662. void category151_keyboard_handler(S32 vkey_code, S32 key_state)
  1663. {
  1664. #if(MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32)
  1665.     /*----------------------------------------------------------------*/
  1666.     /* Local Variables                                                */
  1667.     /*----------------------------------------------------------------*/
  1668.     /*----------------------------------------------------------------*/
  1669.     /* Code Body                                                      */
  1670.     /*----------------------------------------------------------------*/
  1671.     if (key_state)
  1672.     {
  1673.         switch (vkey_code)
  1674.         {
  1675.             case 38:
  1676.                 multiline_inputbox_previous_line();
  1677.                 break;
  1678.             case 40:
  1679.                 multiline_inputbox_next_line();
  1680.                 break;
  1681.         }
  1682.     }
  1683. #else /* (MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32) */ 
  1684.     UI_UNUSED_PARAMETER(vkey_code);
  1685.     UI_UNUSED_PARAMETER(key_state);
  1686. #endif /* (MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32) */ 
  1687. }
  1688. /*****************************************************************************
  1689.  * FUNCTION
  1690.  *  GetCategory151HistorySize
  1691.  * DESCRIPTION
  1692.  *  Gets the size of the history buffer for category69 screen
  1693.  * PARAMETERS
  1694.  *  void
  1695.  * RETURNS
  1696.  *  size in U8s of the history buffer
  1697.  *****************************************************************************/
  1698. S32 GetCategory151HistorySize(void)
  1699. {
  1700.     /*----------------------------------------------------------------*/
  1701.     /* Local Variables                                                */
  1702.     /*----------------------------------------------------------------*/
  1703.     /*----------------------------------------------------------------*/
  1704.     /* Code Body                                                      */
  1705.     /*----------------------------------------------------------------*/
  1706.     return (sizeof(multiline_inputbox_category_history));
  1707. }
  1708. /*****************************************************************************
  1709.  * FUNCTION
  1710.  *  GetCategory151History
  1711.  * DESCRIPTION
  1712.  *  Gets the history buffer for category69 screen
  1713.  * PARAMETERS
  1714.  *  history_buffer      [IN]        Is the buffer into which the history data is stored (pre-allocated)
  1715.  * RETURNS
  1716.  *  Pointer to the history buffer
  1717.  *****************************************************************************/
  1718. U8 *GetCategory151History(U8 *history_buffer)
  1719. {
  1720.     /*----------------------------------------------------------------*/
  1721.     /* Local Variables                                                */
  1722.     /*----------------------------------------------------------------*/
  1723.     /*----------------------------------------------------------------*/
  1724.     /* Code Body                                                      */
  1725.     /*----------------------------------------------------------------*/
  1726.     get_multiline_inputbox_category_history(MMI_CATEGORY151_ID, history_buffer, MMI_current_input_type);
  1727.     return (history_buffer);
  1728. }
  1729. /*****************************************************************************
  1730.  * FUNCTION
  1731.  *  ShowCategory151Screen
  1732.  * DESCRIPTION
  1733.  *  Displays the category151 screen with status bar at the top
  1734.  * PARAMETERS
  1735.  *  title                   [IN]        =0 and title_icon=0, then status bar is displayed instead of the title
  1736.  *  title_icon              [IN]        
  1737.  *  left_softkey            [IN]        Left softkey label
  1738.  *  left_softkey_icon       [IN]        Icon for the left softkey
  1739.  *  right_softkey           [IN]        Right softkey label
  1740.  *  right_softkey_icon      [IN]        Icon for the right softkey
  1741.  *  message                 [IN]        Notification message
  1742.  *  message_icon            [?]         
  1743.  *  history_buffer          [IN]        History buffer
  1744.  *  MMI_ID_TYPE(?)          [IN]        Image          Notification image
  1745.  *  For(?)                  [IN]        Other values, a title is displayed
  1746.  * RETURNS
  1747.  *  void
  1748.  *****************************************************************************/
  1749. void ShowCategory151Screen(
  1750.         U16 title,
  1751.         U16 title_icon,
  1752.         U16 left_softkey,
  1753.         U16 left_softkey_icon,
  1754.         U16 right_softkey,
  1755.         U16 right_softkey_icon,
  1756.         U8 *message,
  1757.         U8 *message_icon,
  1758.         U8 *history_buffer)
  1759. {
  1760.     /*----------------------------------------------------------------*/
  1761.     /* Local Variables                                                */
  1762.     /*----------------------------------------------------------------*/
  1763.     dm_data_struct dm_data;
  1764.     S16 input_type; /* 110805 SAT text Calvin add */
  1765.     /*----------------------------------------------------------------*/
  1766.     /* Code Body                                                      */
  1767.     /*----------------------------------------------------------------*/
  1768.     /* 053005 Calvin added */
  1769. #ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
  1770.     //set_small_screen();
  1771. #endif 
  1772.     /* Calvin end */
  1773.     ShowCommonCategoryPopupScreenType2(
  1774.         title,
  1775.         title_icon,
  1776.         left_softkey,
  1777.         left_softkey_icon,
  1778.         right_softkey,
  1779.         right_softkey_icon,
  1780.         (UI_string_type) message,
  1781.         history_buffer);
  1782.     /* 110805 SAT text Calvin Start */
  1783.     set_multiline_inputbox_category_history(MMI_CATEGORY151_ID, history_buffer, (S16*) & input_type);
  1784.     show_multiline_inputbox_no_draw();
  1785.     /* 110805 SAT text Calvin End */
  1786.     ExitCategoryFunction = ExitCategory151Screen;
  1787.     RedrawCategoryFunction = dm_redraw_category_screen;
  1788.     GetCategoryHistory = GetCategory151History;
  1789.     GetCategoryHistorySize = GetCategory151HistorySize;
  1790.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  1791.     dm_data.s32CatId = MMI_CATEGORY151_ID;
  1792.     dm_data.s32flags = DM_CLEAR_SCREEN_BACKGROUND;
  1793.     if ((title == 0) && (title_icon == 0))
  1794.     {
  1795.         dm_data.s32flags |= DM_NO_TITLE;
  1796.         ShowStatusIconsTitle();
  1797.     }
  1798.     else if (!((title == 0xffff) && (title_icon == 0xffff)))
  1799.     {
  1800.     #if !defined(__MMI_MAINLCD_176X220__) && !defined (__MMI_MAINLCD_240X320__)     /* 041205 Calvin modieid */
  1801.         dm_data.s32flags |= DM_NO_STATUS_BAR;
  1802.     #endif 
  1803.     }
  1804.     else
  1805.     {
  1806.     #if !defined(__MMI_MAINLCD_176X220__) && !defined (__MMI_MAINLCD_240X320__)     /* 041205 Calvin modieid */
  1807.         dm_data.s32flags |= DM_NO_STATUS_BAR | DM_NO_TITLE;
  1808.     #else /* !defined(__MMI_MAINLCD_176X220__) && !defined (__MMI_MAINLCD_240X320__) */ 
  1809.         {
  1810.             dm_data.s32flags |= DM_NO_TITLE;
  1811.             ShowStatusIconsTitle();
  1812.         }
  1813.     #endif /* !defined(__MMI_MAINLCD_176X220__) && !defined (__MMI_MAINLCD_240X320__) */ 
  1814.     }
  1815.     dm_setup_data(&dm_data);
  1816.     MMI_multiline_inputbox.flags &= ~UI_MULTI_LINE_INPUT_BOX_DISABLE_BACKGROUND;
  1817.     dm_add_image(message_icon, NULL, NULL);
  1818.     MMI_multiline_inputbox.normal_filler = &wgui_pop_up_dialog_inputbox_background;
  1819.     dm_redraw_category_screen();
  1820. }
  1821. /*****************************************************************************
  1822.  * FUNCTION
  1823.  *  ShowCategory162Screen
  1824.  * DESCRIPTION
  1825.  *  Displays the category62 screen
  1826.  * PARAMETERS
  1827.  *  left_softkey            [IN]        
  1828.  *  left_softkey_icon       [IN]        
  1829.  *  right_softkey           [IN]        
  1830.  *  right_softkey_icon      [IN]        
  1831.  *  message                 [IN]        Message string
  1832.  *  message_icon            [IN]        
  1833.  *  history_buffer          [IN]        History buffer
  1834.  *  MMI_ID_TYPE(?)          [IN]        Icon        Message icon
  1835.  * RETURNS
  1836.  *  void
  1837.  *****************************************************************************/
  1838. void ShowCategory162Screen(
  1839.         U16 left_softkey,
  1840.         U16 left_softkey_icon,
  1841.         U16 right_softkey,
  1842.         U16 right_softkey_icon,
  1843.         U16 message,
  1844.         U16 message_icon,
  1845.         U8 *history_buffer)
  1846. {
  1847.     /*----------------------------------------------------------------*/
  1848.     /* Local Variables                                                */
  1849.     /*----------------------------------------------------------------*/
  1850.     dm_data_struct dm_data;
  1851.     /*----------------------------------------------------------------*/
  1852.     /* Code Body                                                      */
  1853.     /*----------------------------------------------------------------*/
  1854.     /* 053005 Calvin added */
  1855. #ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
  1856.     set_small_screen();
  1857. #endif 
  1858.     /* Calvin end */
  1859.     ShowCommonCategoryPopupScreenType2(
  1860.         0,
  1861.         0,
  1862.         left_softkey,
  1863.         left_softkey_icon,
  1864.         right_softkey,
  1865.         right_softkey_icon,
  1866.         get_string(message),
  1867.         history_buffer);
  1868.     ExitCategoryFunction = ExitCategory62Screen;
  1869.     RedrawCategoryFunction = dm_redraw_category_screen;
  1870.     GetCategoryHistory = dummy_get_history;
  1871.     GetCategoryHistorySize = dummy_get_history_size;
  1872.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  1873.     dm_data.s32CatId = MMI_CATEGORY162_ID;
  1874.     dm_data.s32flags = DM_NO_TITLE | DM_NO_STATUS_BAR;
  1875.     dm_setup_data(&dm_data);
  1876.     dm_add_image(get_image(message_icon), NULL, NULL);
  1877.     dm_redraw_category_screen();
  1878. }
  1879. /*****************************************************************************
  1880.  * FUNCTION
  1881.  *  ShowCategory163Screen
  1882.  * DESCRIPTION
  1883.  *  Displays the category63 screen
  1884.  * PARAMETERS
  1885.  *  left_softkey            [IN]        
  1886.  *  left_softkey_icon       [IN]        
  1887.  *  right_softkey           [IN]        
  1888.  *  right_softkey_icon      [IN]        
  1889.  *  message                 [IN]        Message string
  1890.  *  message_icon            [IN]        
  1891.  *  history_buffer          [IN]        History buffer
  1892.  *  MMI_ID_TYPE(?)          [IN]        Icon        Message icon
  1893.  * RETURNS
  1894.  *  void
  1895.  *****************************************************************************/
  1896. void ShowCategory163Screen(
  1897.         U16 left_softkey,
  1898.         U16 left_softkey_icon,
  1899.         U16 right_softkey,
  1900.         U16 right_softkey_icon,
  1901.         U8 *message,
  1902.         U16 message_icon,
  1903.         U8 *history_buffer)
  1904. {
  1905.     /*----------------------------------------------------------------*/
  1906.     /* Local Variables                                                */
  1907.     /*----------------------------------------------------------------*/
  1908.     dm_data_struct dm_data;
  1909.     /*----------------------------------------------------------------*/
  1910.     /* Code Body                                                      */
  1911.     /*----------------------------------------------------------------*/
  1912.     /* 053005 Calvin added */
  1913. #ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
  1914.     set_small_screen();
  1915. #endif 
  1916.     /* Calvin end */
  1917.     ShowCommonCategoryPopupScreenType2(
  1918.         0,
  1919.         0,
  1920.         left_softkey,
  1921.         left_softkey_icon,
  1922.         right_softkey,
  1923.         right_softkey_icon,
  1924.         (UI_string_type) message,
  1925.         history_buffer);
  1926.     ExitCategoryFunction = ExitCategory62Screen;
  1927.     RedrawCategoryFunction = dm_redraw_category_screen;
  1928.     GetCategoryHistory = dummy_get_history;
  1929.     GetCategoryHistorySize = dummy_get_history_size;
  1930.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  1931.     dm_data.s32CatId = MMI_CATEGORY162_ID;
  1932.     dm_data.s32flags = DM_NO_TITLE | DM_NO_STATUS_BAR;
  1933.     dm_setup_data(&dm_data);
  1934.     dm_add_image(get_image(message_icon), NULL, NULL);
  1935.     dm_redraw_category_screen();
  1936. }
  1937. /*****************************************************************************
  1938.  * FUNCTION
  1939.  *  ShowCategory164Screen
  1940.  * DESCRIPTION
  1941.  *  Displays the category64 screen
  1942.  * PARAMETERS
  1943.  *  left_softkey            [IN]        
  1944.  *  left_softkey_icon       [IN]        
  1945.  *  right_softkey           [IN]        
  1946.  *  right_softkey_icon      [IN]        
  1947.  *  message                 [IN]        Message string
  1948.  *  message_icon            [IN]        
  1949.  *  history_buffer          [IN]        History buffer
  1950.  *  MMI_ID_TYPE(?)          [IN]        Icon        Message icon
  1951.  * RETURNS
  1952.  *  void
  1953.  *****************************************************************************/
  1954. void ShowCategory164Screen(
  1955.         U16 left_softkey,
  1956.         U16 left_softkey_icon,
  1957.         U16 right_softkey,
  1958.         U16 right_softkey_icon,
  1959.         U16 message,
  1960.         U16 message_icon,
  1961.         U8 *history_buffer)
  1962. {
  1963.     /*----------------------------------------------------------------*/
  1964.     /* Local Variables                                                */
  1965.     /*----------------------------------------------------------------*/
  1966.     dm_data_struct dm_data;
  1967.     /*----------------------------------------------------------------*/
  1968.     /* Code Body                                                      */
  1969.     /*----------------------------------------------------------------*/
  1970.     /* 053005 Calvin added */
  1971. #ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
  1972.     set_small_screen();
  1973. #endif 
  1974.     /* Calvin end */
  1975.     ShowCommonCategoryPopupScreenType2(
  1976.         0,
  1977.         0,
  1978.         left_softkey,
  1979.         left_softkey_icon,
  1980.         right_softkey,
  1981.         right_softkey_icon,
  1982.         get_string(message),
  1983.         history_buffer);
  1984.     ExitCategoryFunction = ExitCategory62Screen;
  1985.     RedrawCategoryFunction = dm_redraw_category_screen;
  1986.     GetCategoryHistory = dummy_get_history;
  1987.     GetCategoryHistorySize = dummy_get_history_size;
  1988.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  1989.     dm_data.s32CatId = MMI_CATEGORY164_ID;
  1990.     dm_data.s32flags = DM_NO_TITLE | DM_NO_STATUS_BAR;
  1991.     dm_setup_data(&dm_data);
  1992.     dm_add_image(get_image(message_icon), NULL, NULL);
  1993.     dm_redraw_category_screen();
  1994. }
  1995. /* MTK Leo start, count down for confirm screen */
  1996. S32 Cat165CountDownValue;
  1997. FuncPtr Cat165TimerExpireCallBack = UI_dummy_function;
  1998. /*****************************************************************************
  1999.  * FUNCTION
  2000.  *  SetCat165TimerExpireFunc
  2001.  * DESCRIPTION
  2002.  *  Set popup countdown callback function
  2003.  * PARAMETERS
  2004.  *  f       [IN]        
  2005.  * RETURNS
  2006.  *  void
  2007.  *****************************************************************************/
  2008. void SetCat165TimerExpireFunc(FuncPtr f)
  2009. {
  2010.     /*----------------------------------------------------------------*/
  2011.     /* Local Variables                                                */
  2012.     /*----------------------------------------------------------------*/
  2013.     /*----------------------------------------------------------------*/
  2014.     /* Code Body                                                      */
  2015.     /*----------------------------------------------------------------*/
  2016.     Cat165TimerExpireCallBack = f;
  2017. }
  2018. /*****************************************************************************
  2019.  * FUNCTION
  2020.  *  Cat165CountDownCallBack
  2021.  * DESCRIPTION
  2022.  *  popup countdown callback function
  2023.  * PARAMETERS
  2024.  *  void
  2025.  * RETURNS
  2026.  *  void
  2027.  *****************************************************************************/
  2028. extern UI_font_type UI_font;
  2029. extern color UI_text_color;
  2030. extern BOOL r2lMMIFlag;
  2031. void Cat165CountDownCallBack(void)
  2032. {
  2033.     /*----------------------------------------------------------------*/
  2034.     /* Local Variables                                                */
  2035.     /*----------------------------------------------------------------*/
  2036.     U8 buf[6];
  2037.     UI_font_type saved_font = UI_font;
  2038.     color saved_color = UI_text_color;
  2039.     /*----------------------------------------------------------------*/
  2040.     /* Code Body                                                      */
  2041.     /*----------------------------------------------------------------*/
  2042.     if (Cat165CountDownValue == 0)
  2043.     {
  2044.         gui_cancel_timer(Cat165CountDownCallBack);
  2045.         if (Cat165TimerExpireCallBack != NULL)
  2046.         {
  2047.             Cat165TimerExpireCallBack();
  2048.         }
  2049.         // Not necessary to reset this callback because it is already reset by exit function
  2050.         // Cat165TimerExpireCallBack = UI_dummy_function;
  2051.     }
  2052.     else
  2053.     {
  2054.         S32 str_width, str_height, width, height;
  2055.         color *fg;
  2056.         color bg;//092106 popup countdown
  2057.         fg = current_MMI_theme->popup_description_text_color;
  2058.         bg = wgui_pop_up_dialog_background.c;
  2059.         gui_set_font(&MMI_medium_font);
  2060.         //gui_set_text_color(UI_COLOR_BLACK);//092106 popup countdown
  2061.         gui_set_text_color(*fg);
  2062.         gui_itoa(Cat165CountDownValue, (UI_string_type) buf, 10);
  2063.         gdi_layer_push_clip();
  2064.         gdi_layer_reset_clip();
  2065.         gui_measure_string((UI_string_type) buf, &str_width, &str_height);
  2066.         width = MMI_pop_up_dialog_width - 5 - str_width;
  2067.     #ifdef __MMI_MAINLCD_128X128__//061306 
  2068.         height = MMI_pop_up_dialog_height - 7 - str_height;
  2069.     #else
  2070.         height = MMI_pop_up_dialog_height - 10 - str_height;
  2071.     #endif
  2072.     #if 0//092106 popup countdown
  2073. /* under construction !*/
  2074. /* under construction !*/
  2075. /* under construction !*/
  2076. /* under construction !*/
  2077. /* under construction !*/
  2078. /* under construction !*/
  2079.     #else
  2080.         gdi_draw_solid_rect(
  2081.             MMI_pop_up_dialog_x + 10,
  2082.             MMI_pop_up_dialog_y + height,
  2083.             MMI_pop_up_dialog_x + MMI_pop_up_dialog_width - 10,
  2084.             MMI_pop_up_dialog_y + height + str_height,
  2085.             gdi_act_color_from_rgb(bg.alpha, bg.r, bg.g, bg.b));
  2086.     #endif
  2087.         if (r2lMMIFlag)
  2088.         {
  2089.             gui_move_text_cursor(
  2090.                 MMI_pop_up_dialog_x + ((MMI_pop_up_dialog_width + str_width) >> 1),
  2091.                 MMI_pop_up_dialog_y + height);
  2092.         }
  2093.         else
  2094.         {
  2095.             gui_move_text_cursor(
  2096.                 MMI_pop_up_dialog_x + ((MMI_pop_up_dialog_width - str_width) >> 1),
  2097.                 MMI_pop_up_dialog_y + height);
  2098.         }
  2099.         gui_print_text((UI_string_type) buf);
  2100.         gdi_layer_pop_clip();
  2101.         gui_BLT_double_buffer(
  2102.             MMI_pop_up_dialog_x + 10,
  2103.             MMI_pop_up_dialog_y + height,
  2104.             MMI_pop_up_dialog_x + MMI_pop_up_dialog_width - 10,
  2105.             MMI_pop_up_dialog_y + height + str_height);
  2106.         gui_set_font(saved_font);
  2107.         gui_set_text_color(saved_color);
  2108.         Cat165CountDownValue--;
  2109.         gui_start_timer(1000, Cat165CountDownCallBack);
  2110.     }
  2111. }
  2112. /*****************************************************************************
  2113.  * FUNCTION
  2114.  *  ShowCategory165Screen_ext
  2115.  * DESCRIPTION
  2116.  *  Displays the category65 screen
  2117.  * PARAMETERS
  2118.  *  left_softkey            [IN]        
  2119.  *  left_softkey_icon       [IN]        
  2120.  *  right_softkey           [IN]        
  2121.  *  right_softkey_icon      [IN]        
  2122.  *  message                 [IN]        Message string
  2123.  *  message_icon            [IN]        
  2124.  *  duration                [IN]        
  2125.  *  history_buffer          [IN]        History buffer
  2126.  *  MMI_ID_TYPE(?)          [IN]        Icon        Message icon
  2127.  * RETURNS
  2128.  *  void
  2129.  *****************************************************************************/
  2130. void ShowCategory165Screen_ext(
  2131.         U16 left_softkey,
  2132.         U16 left_softkey_icon,
  2133.         U16 right_softkey,
  2134.         U16 right_softkey_icon,
  2135.         UI_string_type message,
  2136.         U16 message_icon,
  2137.         S32 duration,
  2138.         U8 *history_buffer)
  2139. {
  2140.     /*----------------------------------------------------------------*/
  2141.     /* Local Variables                                                */
  2142.     /*----------------------------------------------------------------*/
  2143.     dm_data_struct dm_data;
  2144.     /*----------------------------------------------------------------*/
  2145.     /* Code Body                                                      */
  2146.     /*----------------------------------------------------------------*/
  2147.     /* 053005 Calvin added */
  2148. #ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
  2149.     set_small_screen();
  2150. #endif 
  2151.     /* Calvin end */
  2152.     ShowCommonCategoryPopupScreenType2(
  2153.         0,
  2154.         0,
  2155.         left_softkey,
  2156.         left_softkey_icon,
  2157.         right_softkey,
  2158.         right_softkey_icon,
  2159.         (UI_string_type) message,
  2160.         history_buffer);
  2161.     ExitCategoryFunction = ExitCategory165Screen;
  2162.     RedrawCategoryFunction = dm_redraw_category_screen;
  2163.     GetCategoryHistory = dummy_get_history;
  2164.     GetCategoryHistorySize = dummy_get_history_size;
  2165.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  2166.     dm_data.s32CatId = MMI_CATEGORY164_ID;
  2167.     dm_data.s32flags = DM_NO_TITLE | DM_NO_STATUS_BAR;
  2168.     dm_setup_data(&dm_data);
  2169.     dm_add_image(get_image(message_icon), NULL, NULL);
  2170.     dm_redraw_category_screen();
  2171.     Cat165CountDownValue = duration;
  2172.     if (Cat165CountDownValue != 0)
  2173.     {
  2174.         Cat165CountDownCallBack();
  2175.     }
  2176. }
  2177. /*****************************************************************************
  2178.  * FUNCTION
  2179.  *  ShowCategory165Screen
  2180.  * DESCRIPTION
  2181.  *  Displays the category65 screen
  2182.  * PARAMETERS
  2183.  *  left_softkey            [IN]        
  2184.  *  left_softkey_icon       [IN]        
  2185.  *  right_softkey           [IN]        
  2186.  *  right_softkey_icon      [IN]        
  2187.  *  message                 [IN]        Message string
  2188.  *  message_icon            [IN]        
  2189.  *  history_buffer          [IN]        History buffer
  2190.  *  MMI_ID_TYPE(?)          [IN]        Icon        Message icon
  2191.  * RETURNS
  2192.  *  void
  2193.  *****************************************************************************/
  2194. void ShowCategory165Screen(
  2195.         U16 left_softkey,
  2196.         U16 left_softkey_icon,
  2197.         U16 right_softkey,
  2198.         U16 right_softkey_icon,
  2199.         UI_string_type message,
  2200.         U16 message_icon,
  2201.         U8 *history_buffer)
  2202. {
  2203.     /*----------------------------------------------------------------*/
  2204.     /* Local Variables                                                */
  2205.     /*----------------------------------------------------------------*/
  2206.     /*----------------------------------------------------------------*/
  2207.     /* Code Body                                                      */
  2208.     /*----------------------------------------------------------------*/
  2209.     ShowCategory165Screen_ext(
  2210.         left_softkey,
  2211.         left_softkey_icon,
  2212.         right_softkey,
  2213.         right_softkey_icon,
  2214.         message,
  2215.         message_icon,
  2216.         0,
  2217.         history_buffer);
  2218. }
  2219. /* MTK Leo end */
  2220. /*****************************************************************************
  2221.  * FUNCTION
  2222.  *  ExitCategory165Screen
  2223.  * DESCRIPTION
  2224.  *  Exits the category65 screen
  2225.  * PARAMETERS
  2226.  *  void
  2227.  * RETURNS
  2228.  *  void
  2229.  *****************************************************************************/
  2230. void ExitCategory165Screen(void)
  2231. {
  2232.     /*----------------------------------------------------------------*/
  2233.     /* Local Variables                                                */
  2234.     /*----------------------------------------------------------------*/
  2235.     /*----------------------------------------------------------------*/
  2236.     /* Code Body                                                      */
  2237.     /*----------------------------------------------------------------*/
  2238.     /* 053005 Calvin added */
  2239. #ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
  2240.     reset_small_screen();
  2241. #endif 
  2242.     /* Calvin end */
  2243.     gui_hide_animations();
  2244.     gui_cancel_timer(Cat165CountDownCallBack);
  2245.     Cat165TimerExpireCallBack = UI_dummy_function;
  2246.     ExitCategoryFunction = MMI_dummy_function;
  2247.     RedrawCategoryFunction = MMI_dummy_function;
  2248.     GetCategoryHistory = dummy_get_history;
  2249.     GetCategoryHistorySize = dummy_get_history_size;
  2250. }
  2251. #ifdef __MMI_TOUCH_SCREEN__
  2252. /*****************************************************************************
  2253.  * FUNCTION
  2254.  *  DrawCate264CategoryControlArea
  2255.  * DESCRIPTION
  2256.  *  
  2257.  * PARAMETERS
  2258.  *  coordinate      [?]     
  2259.  * RETURNS
  2260.  *  void
  2261.  *****************************************************************************/
  2262. void DrawCate264CategoryControlArea(dm_coordinates *coordinate)
  2263. {
  2264.     /*----------------------------------------------------------------*/
  2265.     /* Local Variables                                                */
  2266.     /*----------------------------------------------------------------*/
  2267.     //      MYTIME  t;
  2268.     //      U8 ran;
  2269.     S32 img_width, img_height;
  2270.     S32 msg_width, msg_height;
  2271.     S32 pop_x = coordinate->s16X;
  2272.     S32 pop_y = coordinate->s16Y;
  2273.     S32 pop_width = coordinate->s16Width;
  2274.     S32 pop_height = coordinate->s16Height;
  2275.     extern S32 wgui_image_clip_x1;
  2276.     extern S32 wgui_image_clip_y1;
  2277.     extern S32 wgui_image_clip_x2;
  2278.     extern S32 wgui_image_clip_y2;
  2279.     /*----------------------------------------------------------------*/
  2280.     /* Code Body                                                      */
  2281.     /*----------------------------------------------------------------*/
  2282.     gdi_image_get_dimension((U8*) MMI_message_icon, &img_width, &img_height);
  2283.     resize_multiline_inputbox_fit((pop_width >> 1), (pop_height >> 1), &msg_width, &msg_height);
  2284.     wgui_image_clip_x1 = pop_x + ((pop_width - img_width) >> 1);
  2285.     wgui_image_clip_y1 = pop_y + ((pop_height - img_height) >> 1);
  2286.     wgui_image_clip_x2 = wgui_image_clip_x1 + img_width;
  2287.     wgui_image_clip_y2 = wgui_image_clip_y1 + img_height;
  2288.     gdi_image_draw(wgui_image_clip_x1, wgui_image_clip_y1, (U8*) MMI_message_icon);
  2289.     move_multiline_inputbox(pop_x + ((pop_width - msg_width) >> 1), pop_y + ((pop_height + img_height) >> 1));
  2290.     show_multiline_inputbox();
  2291.     /* Leo start 20050801 */
  2292.     /*
  2293.      * DTGetRTCTime(&t);
  2294.      * ran=t.nSec%5;
  2295.      * switch (ran)
  2296.      * {
  2297.      * case 0://center
  2298.      * wgui_image_clip_x1 = pop_x+((pop_width-img_width)>>1);
  2299.      * wgui_image_clip_y1 = pop_y+((pop_height-img_height)>>1);
  2300.      * wgui_image_clip_x2 = wgui_image_clip_x1 + img_width;
  2301.      * wgui_image_clip_y2 = wgui_image_clip_y1 + img_height;
  2302.      * gdi_image_draw(wgui_image_clip_x1,wgui_image_clip_y1,(U8*)MMI_message_icon);
  2303.      * move_multiline_inputbox(pop_x+((pop_width-msg_width)>>1), pop_y+((pop_height+img_height)>>1));
  2304.      * show_multiline_inputbox();
  2305.      * break;
  2306.      * 
  2307.      * case 1://Left-Top
  2308.      * wgui_image_clip_x1 = pop_x+5;
  2309.      * wgui_image_clip_y1 = pop_y+5;
  2310.      * wgui_image_clip_x2 = wgui_image_clip_x1 + img_width;
  2311.      * wgui_image_clip_y2 = wgui_image_clip_y1 + img_height;
  2312.      * gdi_image_draw(wgui_image_clip_x1,wgui_image_clip_y1,(U8*)MMI_message_icon);
  2313.      * move_multiline_inputbox(pop_x+5, pop_y+10+img_height);
  2314.      * show_multiline_inputbox();
  2315.      * break;
  2316.      * 
  2317.      * case 2://Left-Bottom
  2318.      * wgui_image_clip_x1 = pop_x+5;
  2319.      * wgui_image_clip_y1 = pop_y+pop_height-img_height-5;
  2320.      * wgui_image_clip_x2 = wgui_image_clip_x1 + img_width;
  2321.      * wgui_image_clip_y2 = wgui_image_clip_y1 + img_height;
  2322.      * gdi_image_draw(wgui_image_clip_x1, wgui_image_clip_y1, (U8*)MMI_message_icon);
  2323.      * move_multiline_inputbox(pop_x+5, pop_y+pop_height-5-img_height-msg_height);
  2324.      * show_multiline_inputbox();
  2325.      * break;
  2326.      * 
  2327.      * case 3://Right-Top
  2328.      * wgui_image_clip_x1 = pop_x+pop_width-img_width-5;
  2329.      * wgui_image_clip_y1 = pop_y+5;
  2330.      * wgui_image_clip_x2 = wgui_image_clip_x1 + img_width;
  2331.      * wgui_image_clip_y2 = wgui_image_clip_y1 + img_height;
  2332.      * gdi_image_draw(wgui_image_clip_x1, wgui_image_clip_y1, (U8*)MMI_message_icon);
  2333.      * move_multiline_inputbox(pop_x+pop_width-msg_width-5, pop_y+5+img_height);
  2334.      * show_multiline_inputbox();
  2335.      * break;
  2336.      * 
  2337.      * case 4://Right-Bottom
  2338.      * wgui_image_clip_x1 = pop_x+pop_width-img_width-5;
  2339.      * wgui_image_clip_y1 = pop_y+pop_height-img_height-5;
  2340.      * wgui_image_clip_x2 = wgui_image_clip_x1 + img_width;
  2341.      * wgui_image_clip_y2 = wgui_image_clip_y1 + img_height;
  2342.      * gdi_image_draw(wgui_image_clip_x1, wgui_image_clip_y1, (U8*)MMI_message_icon);
  2343.      * move_multiline_inputbox(pop_x+pop_width-msg_width-5, pop_y+pop_height-5-img_height-msg_height);
  2344.      * show_multiline_inputbox();
  2345.      * break;
  2346.      * 
  2347.      * }
  2348.      */
  2349.     /* Leo end 20050801 */
  2350. }
  2351. /*****************************************************************************
  2352.  * FUNCTION
  2353.  *  category264_pen_down_handler
  2354.  * DESCRIPTION
  2355.  *  
  2356.  * PARAMETERS
  2357.  *  point       [IN]        
  2358.  * RETURNS
  2359.  *  
  2360.  *****************************************************************************/
  2361. MMI_BOOL category264_pen_down_handler(mmi_pen_point_struct point)
  2362. {
  2363.     /*----------------------------------------------------------------*/
  2364.     /* Local Variables                                                */
  2365.     /*----------------------------------------------------------------*/
  2366.     S32 pos_x = point.x, pos_y = point.y;
  2367.     /*----------------------------------------------------------------*/
  2368.     /* Code Body                                                      */
  2369.     /*----------------------------------------------------------------*/
  2370.     if (g_keylock_context.gKeyPadLockFlag &&
  2371.         (pos_x > wgui_image_clip_x1 && pos_x < wgui_image_clip_x2 && pos_y > wgui_image_clip_y1 &&
  2372.          pos_y < wgui_image_clip_y2))
  2373.     {
  2374.         HandlePoundKeyForUnlock();
  2375.         return MMI_TRUE;
  2376.     }
  2377.     return MMI_FALSE;
  2378. }
  2379. extern void ShowMakeSOSCallScr(void);
  2380. /*****************************************************************************
  2381.  * FUNCTION
  2382.  *  Category264_image_pen_down_handler
  2383.  * DESCRIPTION
  2384.  *  
  2385.  * PARAMETERS
  2386.  *  point       [IN]        
  2387.  * RETURNS
  2388.  *  
  2389.  *****************************************************************************/
  2390. MMI_BOOL Category264_image_pen_down_handler(mmi_pen_point_struct point)
  2391. {
  2392.     /*----------------------------------------------------------------*/
  2393.     /* Local Variables                                                */
  2394.     /*----------------------------------------------------------------*/
  2395.     /*----------------------------------------------------------------*/
  2396.     /* Code Body                                                      */
  2397.     /*----------------------------------------------------------------*/
  2398.     UI_UNUSED_PARAMETER(point);
  2399.     ShowMakeSOSCallScr();
  2400.     return MMI_TRUE;
  2401. }
  2402. /*****************************************************************************
  2403.  * FUNCTION
  2404.  *  ShowCategory264Screen
  2405.  * DESCRIPTION
  2406.  *  
  2407.  * PARAMETERS
  2408.  *  message             [IN]        
  2409.  *  message_icon        [IN]        
  2410.  *  para                [?]         
  2411.  *  history_buffer      [?]         
  2412.  * RETURNS
  2413.  *  void
  2414.  *****************************************************************************/
  2415. void ShowCategory264Screen(UI_string_type message, PU8 message_icon, U16 dial_icon, void *para, U8 *history_buffer)
  2416. {
  2417.     /*----------------------------------------------------------------*/
  2418.     /* Local Variables                                                */
  2419.     /*----------------------------------------------------------------*/
  2420.     dm_data_struct dm_data;
  2421.     /*----------------------------------------------------------------*/
  2422.     /* Code Body                                                      */
  2423.     /*----------------------------------------------------------------*/
  2424.     /* 053005 Calvin added */
  2425. #ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
  2426.     set_small_screen();
  2427. #endif 
  2428.     /* Calvin end */
  2429.     ShowCommonCategoryPopupScreen(message, history_buffer);
  2430.     MMI_message_icon = message_icon;
  2431.     MMI_message_string = message;
  2432.     dm_register_category_controlled_callback(DrawCate264CategoryControlArea);
  2433.     wgui_register_category_screen_control_area_pen_handlers(category264_pen_down_handler, MMI_PEN_EVENT_DOWN);
  2434.     if ( dial_icon == 0 )
  2435.     {
  2436.         dm_add_image(NULL,NULL,NULL );
  2437.     }
  2438.     else
  2439.     {
  2440.         dm_add_image(get_image(IMG_CSK_DIAL_ICON), NULL, NULL);
  2441.         wgui_register_image_control_pen_handlers(0, Category264_image_pen_down_handler, MMI_PEN_EVENT_DOWN);
  2442.     }
  2443.     ExitCategoryFunction = ExitCategory62Screen;
  2444.     RedrawCategoryFunction = dm_redraw_category_screen;
  2445.     GetCategoryHistory = dummy_get_history;
  2446.     GetCategoryHistorySize = dummy_get_history_size;
  2447.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  2448.     dm_data.s32CatId = MMI_CATEGORY264_ID;
  2449.     dm_data.s32flags = 0;
  2450.     dm_setup_data(&dm_data);
  2451.     dm_redraw_category_screen();
  2452. }
  2453. void ShowCategory801Screen(
  2454.         U16 left_softkey,
  2455.         U16 left_softkey_icon,
  2456.         U16 right_softkey,
  2457.         U16 right_softkey_icon,
  2458.         U16 message,
  2459.         U16 message_icon,
  2460.         U8 *history_buffer)
  2461. {
  2462.      DisplayConfirm(
  2463.         STR_GLOBAL_YES,
  2464.         IMG_GLOBAL_YES,
  2465.         STR_GLOBAL_NO,
  2466.         IMG_GLOBAL_NO,
  2467.         get_string(STR_GLOBAL_YES),
  2468.         IMG_GLOBAL_QUESTION,
  2469.         WARNING_TONE);
  2470. }
  2471. #endif /* __MMI_TOUCH_SCREEN__ */