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

MTK

开发平台:

C/C++

  1.        U32 menuItemId=-1; */
  2.     /* 1 Call Exit Handler */
  3.     EntryNewScreen(SCR9003_INITIALSETUP, ExitPhnsetScr, EntryPhnsetScr, NULL);
  4.     /* 2 Get current screen to gui buffer  for history purposes */
  5.     guiBuffer = GetCurrGuiBuffer(SCR9003_INITIALSETUP);
  6.     /* 3. Retrieve no of child of menu item to be displayed */
  7.     /* diamond, 2005/07/01 add _Ext to menu item functions */
  8.     nNumofItem = GetNumOfChild_Ext(MENU9102_INITIAL_SETUP);
  9.     /* 4. Get attribute of menu to be displayed */
  10.     nDispAttribute = GetDispAttributeOfItem(MENU9102_INITIAL_SETUP);
  11.     /* 5. Retrieve string ids in sequence of given menu item to be displayed */
  12.     /* diamond, 2005/07/01 add _Ext to menu item functions */
  13.     GetSequenceStringIds_Ext(MENU9102_INITIAL_SETUP, nStrItemList);
  14.     /* 6 Set current parent id */
  15.     SetParentHandler(MENU9102_INITIAL_SETUP);
  16.     /* 7 Register highlight handler to be called in menu screen */
  17.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  18.     /* 8 Construct the Hints List */
  19.     ConstructHintsList(MENU9102_INITIAL_SETUP, ItemType);
  20. #ifdef __MMI_PHNSET_TWO_LINE_MENUITEM_DISPLAY__
  21.     if (!guiBuffer)
  22.     {
  23.         mmi_phnset_2line_read_setting();
  24.     }
  25.     is_inline_menu_exist = 1;
  26.     wgui_set_pfn_to_get_display_style(mmi_phnset_2line_get_display_style);
  27.     wgui_set_pfn_to_get_current_menu_item_properties(mmi_phnset_2line_get_menuitem_properties);
  28. #endif /* __MMI_PHNSET_TWO_LINE_MENUITEM_DISPLAY__ */ 
  29.     ShowCategory52Screen(
  30.         STR_MENU9102_INITIAL_SETUP,
  31.         MAIN_MENU_TITLE_SETTINGS_ICON,
  32.         STR_GLOBAL_OK,
  33.         IMG_GLOBAL_OK,
  34.         STR_GLOBAL_BACK,
  35.         IMG_GLOBAL_BACK,
  36.         nNumofItem,
  37.         nStrItemList,
  38.         (PU16) gIndexIconsImageList,
  39.         ItemType,
  40.         0,
  41.         0,
  42.         guiBuffer);
  43.     /* 9.Register function with right softkey */
  44.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  45. #ifndef __MMI_PHNSET_TWO_LINE_MENUITEM_DISPLAY__
  46.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  47. #endif 
  48. }
  49. /*****************************************************************************
  50.  * FUNCTION
  51.  *  ExitPhnsetScr
  52.  * DESCRIPTION
  53.  *  This function is Exit function for Phonesetup
  54.  *  Following functions:
  55.  * PARAMETERS
  56.  *  void
  57.  *  a(?)        [IN/OUT]        
  58.  *  b(?)        [IN]            
  59.  * RETURNS
  60.  *  void
  61.  *****************************************************************************/
  62. void ExitPhnsetScr(void)
  63. {
  64.     /*----------------------------------------------------------------*/
  65.     /* Local Variables                                                */
  66.     /*----------------------------------------------------------------*/
  67. #if (  defined(__MMI_NITZ__) && !defined(__MMI_AUTOTIMEZONE_IN_DATEANDTIME__))
  68.     S16 error;
  69.     /*----------------------------------------------------------------*/
  70.     /* Code Body                                                      */
  71.     /*----------------------------------------------------------------*/
  72.     /* Only Write To NVRAM if the value is changes for ON/OFF Keys */
  73.     if (g_phnset_cntx_p->NITZDirtyFlag == TRUE)
  74.     {
  75.         WriteValue(NVRAM_SETTING_AUTOUPDATE_DT_TIME, &(g_phnset_cntx_p->curNITZStatus), DS_BYTE, &error);
  76.         g_phnset_cntx_p->NITZDirtyFlag = FALSE;
  77.     }
  78. #endif /* (  defined(__MMI_NITZ__) && !defined(__MMI_AUTOTIMEZONE_IN_DATEANDTIME__)) */ 
  79. #ifdef __MMI_PHNSET_TWO_LINE_MENUITEM_DISPLAY__
  80.     is_inline_menu_exist = 0;
  81. #endif 
  82. }
  83. /*****************************************************************************
  84.  * FUNCTION
  85.  *  HighlightPhnsetScr
  86.  * DESCRIPTION
  87.  *  This function is highlight handler for Phonesetup
  88.  *  Follow functions: EntryPhnsetScr
  89.  * PARAMETERS
  90.  *  void
  91.  *  a(?)        [IN/OUT]        
  92.  *  b(?)        [IN]            
  93.  * RETURNS
  94.  *  void
  95.  *****************************************************************************/
  96. void HighlightPhnsetScr(void)
  97. {
  98.     /*----------------------------------------------------------------*/
  99.     /* Local Variables                                                */
  100.     /*----------------------------------------------------------------*/
  101.     /*----------------------------------------------------------------*/
  102.     /* Code Body                                                      */
  103.     /*----------------------------------------------------------------*/
  104.     /* 1 Change left soft key icon and label */
  105.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  106.     /* 2 Change right soft key icon and label */
  107.     ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
  108.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  109.     /* 3 Register function for left soft key */
  110.     SetLeftSoftkeyFunction(EntryPhnsetScr, KEY_EVENT_UP);
  111.     SetKeyHandler(EntryPhnsetScr, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  112.     /* 4 Register function for right soft key */
  113.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  114. }
  115. /* Robin 0603: G12C request -- Add Display Setup menu */
  116. #ifdef __MMI_DISP_SETUP_LEVEL_UP__
  117. /*****************************************************************************
  118.  * FUNCTION
  119.  *  HighlightDispSetup
  120.  * DESCRIPTION
  121.  *  This function is highlight handler for Display Setup menu item (same level with pPhone Setup)
  122.  *  Follow functions:
  123.  * PARAMETERS
  124.  *  void
  125.  *  a(?)        [IN/OUT]        
  126.  *  b(?)        [IN]            
  127.  * RETURNS
  128.  *  void
  129.  *****************************************************************************/
  130. void HighlightDispSetup(void)
  131. {
  132.     /*----------------------------------------------------------------*/
  133.     /* Local Variables                                                */
  134.     /*----------------------------------------------------------------*/
  135.     /*----------------------------------------------------------------*/
  136.     /* Code Body                                                      */
  137.     /*----------------------------------------------------------------*/
  138.     /* Change right soft key icon and label */
  139.     ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
  140.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  141.     /* Register function for left soft key */
  142.     SetLeftSoftkeyFunction(EntryDispSetup, KEY_EVENT_UP);
  143.     SetKeyHandler(EntryDispSetup, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  144.     /* Register function for right soft key */
  145.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  146.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  147. }
  148. /*****************************************************************************
  149.  * FUNCTION
  150.  *  EntryDispSetup
  151.  * DESCRIPTION
  152.  *  This function is Entry function for Display Setup
  153.  * PARAMETERS
  154.  *  void
  155.  *  a(?)        [IN/OUT]        
  156.  *  b(?)        [IN]            
  157.  * RETURNS
  158.  *  void
  159.  *****************************************************************************/
  160. void EntryDispSetup(void)
  161. {
  162.     /*----------------------------------------------------------------*/
  163.     /* Local Variables                                                */
  164.     /*----------------------------------------------------------------*/
  165.     U16 nStrItemList[MAX_SUB_MENUS];    /* Stores the strings id of submenus returned */
  166.     U16 nNumofItem;                     /* Stores no of children in the submenu */
  167.     U16 nDispAttribute;                 /* Stores display attribue */
  168.     U8 *guiBuffer;                      /* Buffer holding history data */
  169.     U8 *ItemType[MAX_SUB_MENUS];
  170.     U32 maskingByte = -1;
  171.     U32 menuItemId = -1;
  172.     /*----------------------------------------------------------------*/
  173.     /* Code Body                                                      */
  174.     /*----------------------------------------------------------------*/
  175.     /* 1 Call Exit Handler */
  176.     EntryNewScreen(SCR_DISP_SETUP, NULL, EntryDispSetup, NULL);
  177.     /* 2 Get current screen to gui buffer  for history purposes */
  178.     guiBuffer = GetCurrGuiBuffer(SCR_DISP_SETUP);
  179.     /* 3. Retrieve no of child of menu item to be displayed */
  180.     nNumofItem = GetNumOfChild(MENU_DISP_SETUP);
  181.     /* 4. Get attribute of menu to be displayed */
  182.     nDispAttribute = GetDispAttributeOfItem(MENU_DISP_SETUP);
  183.     /* 5. Retrieve string ids in sequence of given menu item to be displayed */
  184.     GetSequenceStringIds(MENU_DISP_SETUP, nStrItemList);
  185.     /* 6 Set current parent id */
  186.     SetParentHandler(MENU_DISP_SETUP);
  187.     /* 7 Register highlight handler to be called in menu screen */
  188.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  189.     /* 8 Construct the Hints List */
  190.     ConstructHintsList(MENU_DISP_SETUP, ItemType);
  191.     ShowCategory52Screen(
  192.         STR_DISP_SETUP,
  193.         MAIN_MENU_TITLE_SETTINGS_ICON,
  194.         STR_GLOBAL_OK,
  195.         IMG_GLOBAL_OK,
  196.         STR_GLOBAL_BACK,
  197.         IMG_GLOBAL_BACK,
  198.         nNumofItem,
  199.         nStrItemList,
  200.         (PU16) gIndexIconsImageList,
  201.         ItemType,
  202.         0,
  203.         0,
  204.         guiBuffer);
  205.     /* 9.Register function with right softkey */
  206.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  207.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  208.     /* 10. Register Exit handler */
  209.     //SetExitHandler(SCR9003_INITIALSETUP, ExitPhnsetScr);
  210.     //SetGenericExitHandler( SCR_DISP_SETUP, NULL, EntryDispSetup);
  211. }
  212. #endif /* __MMI_DISP_SETUP_LEVEL_UP__ */ 
  213. /*****************************************************************************
  214.  * FUNCTION
  215.  *  HighlightPhnsetIdleScrDisp
  216.  * DESCRIPTION
  217.  *  This function is highlight handler for Phonesetup-> IdleScreenDisplay
  218.  *  Follow functions:
  219.  * PARAMETERS
  220.  *  void
  221.  *  a(?)        [IN/OUT]        
  222.  *  b(?)        [IN]            
  223.  * RETURNS
  224.  *  void
  225.  *****************************************************************************/
  226. void HighlightPhnsetIdleScrDisp(void)
  227. {
  228.     /*----------------------------------------------------------------*/
  229.     /* Local Variables                                                */
  230.     /*----------------------------------------------------------------*/
  231.     /*----------------------------------------------------------------*/
  232.     /* Code Body                                                      */
  233.     /*----------------------------------------------------------------*/
  234.     /* Change right soft key icon and label */
  235.     ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
  236.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  237.     /* Register function for left soft key */
  238.     SetLeftSoftkeyFunction(EntryPhnsetIdleScrDisp, KEY_EVENT_UP);
  239.     SetKeyHandler(EntryPhnsetIdleScrDisp, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  240.     /* Register function for right soft key */
  241.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  242.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  243. }
  244. /*****************************************************************************
  245.  * FUNCTION
  246.  *  EntryPhnsetIdleScrDisp
  247.  * DESCRIPTION
  248.  *  This function is Exit function for Phonesetup->IdleScreenDisplay
  249.  *  Following functions:
  250.  * PARAMETERS
  251.  *  void
  252.  *  a(?)        [IN/OUT]        
  253.  *  b(?)        [IN]            
  254.  * RETURNS
  255.  *  void
  256.  *****************************************************************************/
  257. void EntryPhnsetIdleScrDisp(void)
  258. {
  259.     /*----------------------------------------------------------------*/
  260.     /* Local Variables                                                */
  261.     /*----------------------------------------------------------------*/
  262.     U16 nStrItemList[MAX_SUB_MENUS];    /* Stores the strings id of submenus returned */
  263.     U16 nNumofItem;                     /* Stores no of children in the submenu */
  264.     U16 nDispAttribute;                 /* Stores display attribue */
  265.     U8 *guiBuffer;                      /* Buffer holding history data */
  266.     U8 *IdleScrDispType[MAX_SUB_MENUS];
  267.     /*----------------------------------------------------------------*/
  268.     /* Code Body                                                      */
  269.     /*----------------------------------------------------------------*/
  270.     /* Call Exit Handler */
  271.     EntryNewScreen(SCR_IDLE_SCR_DISP, ExitPhnsetIdleScrDisp, EntryPhnsetIdleScrDisp, NULL);
  272.     /* Get current screen to gui buffer  for history purposes */
  273.     guiBuffer = GetCurrGuiBuffer(SCR_IDLE_SCR_DISP);
  274.     /* Retrieve no of child of menu item to be displayed */
  275.     nNumofItem = GetNumOfChild_Ext(MENU_IDLE_SCR_DISP);
  276.     /* Get attribute of menu to be displayed */
  277.     nDispAttribute = GetDispAttributeOfItem(MENU_IDLE_SCR_DISP);
  278.     /* Retrieve string ids in sequence of given menu item to be displayed */
  279.     GetSequenceStringIds_Ext(MENU_IDLE_SCR_DISP, nStrItemList);
  280.     /* Set current parent id */
  281.     SetParentHandler(MENU_IDLE_SCR_DISP);
  282.     /* Register highlight handler to be called in menu screen */
  283.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  284.     /* If Screen Saver is Off then Set The HintHnadler to NULL instead of
  285.        passing empty screen */
  286.     if (PhnsetGetCurScrSvrStatus() != SET_SS_STATUS_OFF)
  287.     {
  288.         SetHintHandler(MENU_SETTING_SCR_SVR, HintPhnsetScreenSaver);
  289.     }
  290.     else
  291.     {
  292.         SetHintHandler(MENU_SETTING_SCR_SVR, NULL);
  293.     }
  294.     /* Constrct Hint for Idle Screen Display */
  295.     ConstructHintsList(MENU_IDLE_SCR_DISP, IdleScrDispType);
  296.     /* Display Category Screen */
  297.     ShowCategory52Screen(
  298.         STR_IDLE_SCR_DISP,
  299.         MAIN_MENU_TITLE_SETTINGS_ICON,
  300.         STR_GLOBAL_OK,
  301.         IMG_GLOBAL_OK,
  302.         STR_GLOBAL_BACK,
  303.         IMG_GLOBAL_BACK,
  304.         nNumofItem,
  305.         nStrItemList,
  306.         (PU16) gIndexIconsImageList,
  307.         IdleScrDispType,
  308.         0,
  309.         0,
  310.         guiBuffer);
  311.     /* Register function with softkey */
  312.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  313.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  314. }
  315. /*****************************************************************************
  316.  * FUNCTION
  317.  *  ExitPhnsetIdleScrDisp
  318.  * DESCRIPTION
  319.  *  This function is Exit function for Phonesetup->IdleScreenDisplay
  320.  *  Functionality: Save 1. Save Owner number  2. Show date and time status
  321.  * PARAMETERS
  322.  *  void
  323.  *  a(?)        [IN/OUT]        
  324.  *  b(?)        [IN]            
  325.  * RETURNS
  326.  *  void
  327.  *****************************************************************************/
  328. void ExitPhnsetIdleScrDisp(void)
  329. {
  330.     /*----------------------------------------------------------------*/
  331.     /* Local Variables                                                */
  332.     /*----------------------------------------------------------------*/
  333.     S16 error;
  334.     /*----------------------------------------------------------------*/
  335.     /* Code Body                                                      */
  336.     /*----------------------------------------------------------------*/
  337.     /* Save NVRAM only when value is changed for date time and 
  338.        own type on idle screen */
  339.     if (g_phnset_cntx_p->ShowDtDirtyFlag == TRUE)
  340.     {
  341.         WriteValue(NVRAM_SETTING_STATUS_DT_TIME, &(g_phnset_cntx_p->curShowDtStatus), DS_BYTE, &error);
  342.         g_phnset_cntx_p->ShowDtDirtyFlag = FALSE;
  343.     }
  344.     if (g_phnset_cntx_p->ShowOwnNumDirtyFlag == TRUE)
  345.     {
  346.         WriteValue(NVRAM_SETTING_OWNER_NO, &(g_phnset_cntx_p->curShowOwnNumStatus), DS_BYTE, &error);
  347.         g_phnset_cntx_p->ShowOwnNumDirtyFlag = FALSE;
  348.     }
  349.     /* Lisen 0921-1 */
  350. #if defined(__MMI_OPERATOR_NAME_MENU__)
  351.     if (g_phnset_cntx_p->ShowOPNDirtyFlag == TRUE)
  352.     {
  353.         WriteValue(NVRAM_SETTING_OPN_DISPLAY, &(g_phnset_cntx_p->curShowOPNStatus), DS_BYTE, &error);
  354.         g_phnset_cntx_p->ShowOPNDirtyFlag = FALSE;
  355.     }
  356. #endif /* defined(__MMI_OPERATOR_NAME_MENU__) */ 
  357. }
  358. #ifdef __MMI_MAINMENU_STYLE_CHANGE_EN__
  359. /*****************************************************************************
  360.  * FUNCTION
  361.  *  HintPhnsetMainMenuStyle
  362.  * DESCRIPTION
  363.  *  This function is Hint handler for Phonesetup->IdleScreenDisplay --> Mainmenu style
  364.  *  Follow functions:
  365.  * PARAMETERS
  366.  *  index       [IN]            
  367.  *  a(?)        [IN/OUT]        
  368.  *  b(?)        [IN]            
  369.  * RETURNS
  370.  *  void
  371.  *****************************************************************************/
  372. void HintPhnsetMainMenuStyle(U16 index)
  373. {
  374.     /*----------------------------------------------------------------*/
  375.     /* Local Variables                                                */
  376.     /*----------------------------------------------------------------*/
  377.     PS8 p = NULL;
  378.     U8 style = PhnsetGetMainMenuStyle();
  379.     /*----------------------------------------------------------------*/
  380.     /* Code Body                                                      */
  381.     /*----------------------------------------------------------------*/
  382.     switch (style)
  383.     {
  384.     #ifdef __MMI_MAINMENU_MATRIX_SUPPORT__  /* 071705 Calvin added */
  385.         case PHNSET_MAINMENU_STYLE_MATRIX:
  386.             p = GetString(STR_MAINMENU_STYLE_MATRIX);
  387.             break;
  388.     #endif /* __MMI_MAINMENU_MATRIX_SUPPORT__ */ 
  389.     #ifdef __MMI_MAINMENU_PAGE_SUPPORT__    /* 071705 Calvin added */
  390.         case PHNSET_MAINMENU_STYLE_PAGE:
  391.             p = GetString(STR_MAINMENU_STYLE_PAGE);
  392.             break;
  393.     #endif /* __MMI_MAINMENU_PAGE_SUPPORT__ */ 
  394.     #ifdef __MMI_MAINMENU_LIST_SUPPORT__    /* 071705 Calvin added */
  395.         case PHNSET_MAINMENU_STYLE_LIST:
  396.             p = GetString(STR_MAINMENU_STYLE_LIST);
  397.             break;
  398.     #endif /* __MMI_MAINMENU_LIST_SUPPORT__ */ 
  399.     #ifdef __MMI_MAINMENU_CIRCULAR_SUPPORT__        /* 071705 Calvin modified */
  400.         case PHNSET_MAINMENU_STYLE_CIRCULE:
  401.             p = GetString(STR_MAINMENU_STYLE_CIRCULAR);
  402.             break;
  403.     #endif /* __MMI_MAINMENU_CIRCULAR_SUPPORT__ */ 
  404.     #ifdef __MMI_MAINMENU_ROTATE_SUPPORT__
  405.         case PHNSET_MAINMENU_STYLE_ROTATE:
  406.             p = GetString(STR_MAINMENU_STYLE_ROTATE);   /* PDG1   Manish */
  407.             break;
  408.     #endif /* __MMI_MAINMENU_ROTATE_SUPPORT__ */ 
  409.     #ifdef __MMI_MAINMENU_TAB_SUPPORT__     /* 071705 Calvin modified */
  410.         case PHNSET_MAINMENU_STYLE_TAB:
  411.             p = GetString(STR_MAINMENU_STYLE_TAB);
  412.             break;
  413.     #endif /* __MMI_MAINMENU_TAB_SUPPORT__ */ 
  414.         default:
  415.             p = GetString(STR_GLOBAL_EMPTY);
  416.             break;
  417.     }
  418.     pfnUnicodeStrcpy((PS8) hintData[index], (PS8) p);
  419. }
  420. /*****************************************************************************
  421.  * FUNCTION
  422.  *  HighlightPhnsetMainMenuStyle
  423.  * DESCRIPTION
  424.  *  This function is Highlight handler for Phonesetup->IdleScreenDisplay --> Mainmenu style
  425.  *  Follow functions: EntryPhnsetMainMenuStyle
  426.  * PARAMETERS
  427.  *  void
  428.  *  a(?)        [IN/OUT]        
  429.  *  b(?)        [IN]            
  430.  * RETURNS
  431.  *  void
  432.  *****************************************************************************/
  433. void HighlightPhnsetMainMenuStyle(void)
  434. {
  435.     /*----------------------------------------------------------------*/
  436.     /* Local Variables                                                */
  437.     /*----------------------------------------------------------------*/
  438.     /*----------------------------------------------------------------*/
  439.     /* Code Body                                                      */
  440.     /*----------------------------------------------------------------*/
  441.     /* Change right soft key icon and label */
  442.     ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
  443.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  444.     /* Register function for left soft key */
  445.     SetLeftSoftkeyFunction(EntryPhnsetMainMenuStyle, KEY_EVENT_UP);
  446.     SetKeyHandler(EntryPhnsetMainMenuStyle, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  447.     /* Register function for right soft key */
  448.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  449.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  450. }
  451. /*****************************************************************************
  452.  * FUNCTION
  453.  *  EntryPhnsetMainMenuStyle
  454.  * DESCRIPTION
  455.  *  This function is Entry function for Phonesetup->IdleScreenDisplay --> Main Menu Style
  456.  *  Following functions: HighlightPhnsetMainMenuStyleSelect
  457.  * PARAMETERS
  458.  *  void
  459.  *  a(?)        [IN/OUT]        
  460.  *  b(?)        [IN]            
  461.  * RETURNS
  462.  *  void
  463.  *****************************************************************************/
  464. void EntryPhnsetMainMenuStyle(void)
  465. {
  466.     /*----------------------------------------------------------------*/
  467.     /* Local Variables                                                */
  468.     /*----------------------------------------------------------------*/
  469.     U16 nStrItemList[MAX_SUB_MENUS];    /* Stores the strings id of submenus returned */
  470.     U16 nNumofItem;                     /* Stores no of children in the submenu */
  471.     U16 nDispAttribute;                 /* Stores display attribue */
  472.     U8 *guiBuffer;                      /* Buffer holding history data */
  473.     /*----------------------------------------------------------------*/
  474.     /* Code Body                                                      */
  475.     /*----------------------------------------------------------------*/
  476.     //S16 Err=0;
  477.     //U8 *IdleScrDispType[MAX_SUB_MENUS];
  478.     /* Call Exit Handler */
  479.     EntryNewScreen(SCR_MAINMENU_STYLE, NULL, EntryPhnsetMainMenuStyle, NULL);
  480.     /* Get current screen to gui buffer  for history purposes */
  481.     guiBuffer = GetCurrGuiBuffer(SCR_MAINMENU_STYLE);
  482.     /* Retrieve no of child of menu item to be displayed */
  483.     nNumofItem = GetNumOfChild(MENU_SETTING_MAINMENU_STYLE);
  484.     /* Get attribute of menu to be displayed */
  485.     nDispAttribute = GetDispAttributeOfItem(MENU_SETTING_MAINMENU_STYLE);
  486.     /* Retrieve string ids in sequence of given menu item to be displayed */
  487.     GetSequenceStringIds(MENU_SETTING_MAINMENU_STYLE, nStrItemList);
  488.     /* Set current parent id */
  489.     SetParentHandler(MENU_SETTING_MAINMENU_STYLE);
  490.     /* Register highlight handler to be called in menu screen */
  491.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  492.     /* Display Category Screen */
  493.     ShowCategory11Screen(
  494.         STR_MAINMENU_STYLE,
  495.         MAIN_MENU_TITLE_SETTINGS_ICON,
  496.         STR_GLOBAL_OK,
  497.         IMG_GLOBAL_OK,
  498.         STR_GLOBAL_BACK,
  499.         IMG_GLOBAL_BACK,
  500.         nNumofItem,
  501.         nStrItemList,
  502.         g_phnset_cntx_p->MenuStyle,
  503.         guiBuffer);
  504.     /* Register function with softkey */
  505.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  506.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  507. }
  508. /*****************************************************************************
  509.  * FUNCTION
  510.  *  HighlightPhnsetMainMenuStyleSelect
  511.  * DESCRIPTION
  512.  *  This function is Highlight handler for Phonesetup->IdleScreenDisplay --> Mainmenu style
  513.  *  Follow functions: PhnsetMainMenuStyleSelectLskHdlr
  514.  * PARAMETERS
  515.  *  void
  516.  *  a(?)        [IN/OUT]        
  517.  *  b(?)        [IN]            
  518.  * RETURNS
  519.  *  void
  520.  *****************************************************************************/
  521. void HighlightPhnsetMainMenuStyleSelect(void)
  522. {
  523.     /*----------------------------------------------------------------*/
  524.     /* Local Variables                                                */
  525.     /*----------------------------------------------------------------*/
  526.     /*----------------------------------------------------------------*/
  527.     /* Code Body                                                      */
  528.     /*----------------------------------------------------------------*/
  529.     /* Change right soft key icon and label */
  530.     ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
  531.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  532.     /* Register function for left soft key */
  533.     SetLeftSoftkeyFunction(PhnsetMainMenuStyleSelectLskHdlr, KEY_EVENT_UP);
  534.     /* Register function for right soft key */
  535.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  536. }
  537. /*****************************************************************************
  538.  * FUNCTION
  539.  *  PhnsetMainMenuStyleSelectLskHdlr
  540.  * DESCRIPTION
  541.  *  This function is left softkey handling function
  542.  *  for Phonesetup->IdleScreenDisplay -> MainMenu style -> Select
  543.  *  Functionality: Save the setting menu style
  544.  * PARAMETERS
  545.  *  void
  546.  *  a(?)        [IN/OUT]        
  547.  *  b(?)        [IN]            
  548.  * RETURNS
  549.  *  void
  550.  *****************************************************************************/
  551. void PhnsetMainMenuStyleSelectLskHdlr(void)
  552. {
  553.     /*----------------------------------------------------------------*/
  554.     /* Local Variables                                                */
  555.     /*----------------------------------------------------------------*/
  556.     U8 HighlightItem = 0;
  557.     S16 Err;
  558.     /*----------------------------------------------------------------*/
  559.     /* Code Body                                                      */
  560.     /*----------------------------------------------------------------*/
  561.     HighlightItem = (U8) GetHighlightedItem();
  562.     if (g_phnset_cntx_p->MenuStyle != HighlightItem)
  563.     {
  564.         g_phnset_cntx_p->MenuStyle = HighlightItem;
  565.         WriteValue(NVRAM_SET_MAINMENU_STYLE, &(g_phnset_cntx_p->MenuStyle), DS_BYTE, &Err);
  566.     }
  567.     DisplayPopup((U8*) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, 2000, SUCCESS_TONE);
  568.     DeleteNScrId(SCR_MAINMENU_STYLE);
  569. }
  570. /*****************************************************************************
  571.  * FUNCTION
  572.  *  PhnsetGetMainMenuStyle
  573.  * DESCRIPTION
  574.  *  This function is to get setting main menu style
  575.  * PARAMETERS
  576.  *  void
  577.  *  a(?)        [IN/OUT]        
  578.  *  b(?)        [IN]            
  579.  * RETURNS
  580.  *  void
  581.  *****************************************************************************/
  582. U8 PhnsetGetMainMenuStyle(void)
  583. {
  584.     /*----------------------------------------------------------------*/
  585.     /* Local Variables                                                */
  586.     /*----------------------------------------------------------------*/
  587.     /*----------------------------------------------------------------*/
  588.     /* Code Body                                                      */
  589.     /*----------------------------------------------------------------*/
  590.     return g_phnset_cntx_p->MenuStyle;
  591. }
  592. #endif /* __MMI_MAINMENU_STYLE_CHANGE_EN__ */ 
  593. /*****************************************************************************
  594.  * FUNCTION
  595.  *  HighlightPhnsetShowDtTime
  596.  * DESCRIPTION
  597.  *  This function is highlight handler for Phonesetup->IdleScreenDisplay-> Show Date and Time
  598.  *  Follow functions:
  599.  * PARAMETERS
  600.  *  void
  601.  *  a(?)        [IN/OUT]        
  602.  *  b(?)        [IN]            
  603.  * RETURNS
  604.  *  void
  605.  *****************************************************************************/
  606. void HighlightPhnsetShowDtTime(void)
  607. {
  608.     /*----------------------------------------------------------------*/
  609.     /* Local Variables                                                */
  610.     /*----------------------------------------------------------------*/
  611.     /*----------------------------------------------------------------*/
  612.     /* Code Body                                                      */
  613.     /*----------------------------------------------------------------*/
  614.     /* If Show Date Time if On Show LSK as OFF otherwise On. */
  615.     if (g_phnset_cntx_p->curShowDtStatus)
  616.     {
  617.         ChangeLeftSoftkey(STR_GLOBAL_OFF, 0);
  618.     }
  619.     else
  620.     {
  621.         ChangeLeftSoftkey(STR_GLOBAL_ON, 0);
  622.     }
  623.     ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
  624.     SetLeftSoftkeyFunction(PhnsetToggleShowDtTime, KEY_EVENT_UP);
  625.     SetKeyHandler(0, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  626.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  627.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  628. }
  629. /*****************************************************************************
  630.  * FUNCTION
  631.  *  PhnsetToggleShowDtTime
  632.  * DESCRIPTION
  633.  *  This function is Left softkey handler
  634.  *  for Phonesetup->IdleScreenDisplay-> Show Date and Time
  635.  * PARAMETERS
  636.  *  void
  637.  *  a(?)        [IN/OUT]        
  638.  *  b(?)        [IN]            
  639.  * RETURNS
  640.  *  void
  641.  *****************************************************************************/
  642. void PhnsetToggleShowDtTime(void)
  643. {
  644.     /*----------------------------------------------------------------*/
  645.     /* Local Variables                                                */
  646.     /*----------------------------------------------------------------*/
  647.     U16 index;
  648.     /*----------------------------------------------------------------*/
  649.     /* Code Body                                                      */
  650.     /*----------------------------------------------------------------*/
  651.     index = GetCurrHiliteID();
  652.     /* if show date time is on chnage it off */
  653.     if (g_phnset_cntx_p->curShowDtStatus)
  654.     {
  655.         g_phnset_cntx_p->curShowDtStatus = 0;
  656.     }
  657.     /* else chnage it on */
  658.     else
  659.     {
  660.         g_phnset_cntx_p->curShowDtStatus = 1;
  661.     }
  662.     /* Flag to Indicate Value is changed, will be used on exit Handler of menu */
  663.     g_phnset_cntx_p->ShowDtDirtyFlag = TRUE;
  664.     if (g_phnset_cntx_p->curShowDtStatus)
  665.     {
  666.         pfnUnicodeStrcpy((PS8) hintData[index], (PS8) GetString(STR_GLOBAL_ON));
  667.         Category52ChangeItemDescription(index, hintData[index]);
  668.         ChangeLeftSoftkey(STR_GLOBAL_OFF, 0);
  669.     }
  670.     else
  671.     {
  672.         pfnUnicodeStrcpy((PS8) hintData[index], (PS8) GetString(STR_GLOBAL_OFF));
  673.         Category52ChangeItemDescription(index, hintData[index]);
  674.         ChangeLeftSoftkey(STR_GLOBAL_ON, 0);
  675.     }
  676.     /* Redraw the Category Screen As Hint Handler and LSK are going to Chnage */
  677.     RedrawCategoryFunction();
  678.     /* After redraw hight the ShowDateTime */
  679.     HighlightPhnsetShowDtTime();
  680. }
  681. /*****************************************************************************
  682.  * FUNCTION
  683.  *  HighlightPhnsetShowOwnNo
  684.  * DESCRIPTION
  685.  *  This function is highlight handler for Phonesetup->IdleScreenDisplay->Show Owner Number
  686.  *  Follow functions:
  687.  * PARAMETERS
  688.  *  void
  689.  *  a(?)        [IN/OUT]        
  690.  *  b(?)        [IN]            
  691.  * RETURNS
  692.  *  void
  693.  *****************************************************************************/
  694. void HighlightPhnsetShowOwnNo(void)
  695. {
  696.     /*----------------------------------------------------------------*/
  697.     /* Local Variables                                                */
  698.     /*----------------------------------------------------------------*/
  699.     U16 index;
  700.     /*----------------------------------------------------------------*/
  701.     /* Code Body                                                      */
  702.     /*----------------------------------------------------------------*/
  703.     index = GetCurrHiliteID();
  704.     /* If Owner Number Is On Change The LSK to OFF otherwise ON. */
  705.     if (g_phnset_cntx_p->curShowOwnNumStatus == 1)
  706.     {
  707.         ChangeLeftSoftkey(STR_GLOBAL_OFF, 0);
  708.     }
  709.     else
  710.     {
  711.         ChangeLeftSoftkey(STR_GLOBAL_ON, 0);
  712.     }
  713.     /* Change right soft key icon and label */
  714.     ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
  715.     SetLeftSoftkeyFunction(PhnsetToggleShowOwnNo, KEY_EVENT_UP);
  716.     SetKeyHandler(0, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  717.     /* Register function for right soft key */
  718.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  719.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  720. }
  721. /*****************************************************************************
  722.  * FUNCTION
  723.  *  PhnsetToggleShowOwnNo
  724.  * DESCRIPTION
  725.  *  This function is Left softkey handler
  726.  *  for Phonesetup->IdleScreenDisplay-> Show owner number
  727.  * PARAMETERS
  728.  *  void
  729.  *  a(?)        [IN/OUT]        
  730.  *  b(?)        [IN]            
  731.  * RETURNS
  732.  *  void
  733.  *****************************************************************************/
  734. void PhnsetToggleShowOwnNo(void)
  735. {
  736.     /*----------------------------------------------------------------*/
  737.     /* Local Variables                                                */
  738.     /*----------------------------------------------------------------*/
  739.     U16 index;
  740.     /*----------------------------------------------------------------*/
  741.     /* Code Body                                                      */
  742.     /*----------------------------------------------------------------*/
  743.     index = GetCurrHiliteID();
  744.     /* If Own Number Display if Off then turn it On Pressing LSK */
  745.     if (g_phnset_cntx_p->curShowOwnNumStatus == 0)
  746.     {
  747.         g_phnset_cntx_p->curShowOwnNumStatus = 1;
  748.     }
  749.     else
  750.     {
  751.         g_phnset_cntx_p->curShowOwnNumStatus = 0;
  752.     }
  753.     /* Flag to write NVRAM in Exit Handler */
  754.     g_phnset_cntx_p->ShowOwnNumDirtyFlag = TRUE;
  755.     if (g_phnset_cntx_p->curShowOwnNumStatus)
  756.     {
  757.         pfnUnicodeStrcpy((PS8) hintData[index], (PS8) GetString(STR_GLOBAL_ON));
  758.         Category52ChangeItemDescription(index, hintData[index]);
  759.         ChangeLeftSoftkey(STR_GLOBAL_OFF, 0);
  760.     }
  761.     else
  762.     {
  763.         pfnUnicodeStrcpy((PS8) hintData[index], (PS8) GetString(STR_GLOBAL_OFF));
  764.         Category52ChangeItemDescription(index, hintData[index]);
  765.         ChangeLeftSoftkey(STR_GLOBAL_ON, 0);
  766.     }
  767.     RedrawCategoryFunction();
  768.     HighlightPhnsetShowOwnNo();
  769. }
  770. /* Lisen 0921-1 */
  771. #if defined(__MMI_OPERATOR_NAME_MENU__)
  772. /*****************************************************************************
  773.  * FUNCTION
  774.  *  HighlightPhnsetShowOPN
  775.  * DESCRIPTION
  776.  *  This function is highlight handler for Phonesetup->IdleScreenDisplay->Show Operator Name
  777.  *  Follow functions:
  778.  * PARAMETERS
  779.  *  void
  780.  *  a(?)        [IN/OUT]        
  781.  *  b(?)        [IN]            
  782.  * RETURNS
  783.  *  void
  784.  *****************************************************************************/
  785. void HighlightPhnsetShowOPN(void)
  786. {
  787.     /*----------------------------------------------------------------*/
  788.     /* Local Variables                                                */
  789.     /*----------------------------------------------------------------*/
  790.     U16 index;
  791.     /*----------------------------------------------------------------*/
  792.     /* Code Body                                                      */
  793.     /*----------------------------------------------------------------*/
  794.     index = GetCurrHiliteID();
  795.     /* If Owner Number Is On Change The LSK to OFF otherwise ON. */
  796.     if (g_phnset_cntx_p->curShowOPNStatus == 1)
  797.     {
  798.         ChangeLeftSoftkey(STR_GLOBAL_OFF, 0);
  799.     }
  800.     else
  801.     {
  802.         ChangeLeftSoftkey(STR_GLOBAL_ON, 0);
  803.     }
  804.     /* Change right soft key icon and label */
  805.     ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
  806.     SetLeftSoftkeyFunction(PhnsetToggleShowOPN, KEY_EVENT_UP);
  807.     SetKeyHandler(0, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  808.     /* Register function for right soft key */
  809.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  810.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  811. }
  812. /*****************************************************************************
  813.  * FUNCTION
  814.  *  PhnsetToggleShowOPN
  815.  * DESCRIPTION
  816.  *  This function is Left softkey handler
  817.  *  for Phonesetup->IdleScreenDisplay-> Show Operator Name
  818.  * PARAMETERS
  819.  *  void
  820.  *  a(?)        [IN/OUT]        
  821.  *  b(?)        [IN]            
  822.  * RETURNS
  823.  *  void
  824.  *****************************************************************************/
  825. void PhnsetToggleShowOPN(void)
  826. {
  827.     /*----------------------------------------------------------------*/
  828.     /* Local Variables                                                */
  829.     /*----------------------------------------------------------------*/
  830.     U16 index;
  831.     /*----------------------------------------------------------------*/
  832.     /* Code Body                                                      */
  833.     /*----------------------------------------------------------------*/
  834.     index = GetCurrHiliteID();
  835.     /* If Own Number Display if Off then turn it On Pressing LSK */
  836.     if (g_phnset_cntx_p->curShowOPNStatus == 0)
  837.     {
  838.         g_phnset_cntx_p->curShowOPNStatus = 1;
  839.     }
  840.     else
  841.     {
  842.         g_phnset_cntx_p->curShowOPNStatus = 0;
  843.     }
  844.     /* Flag to write NVRAM in Exit Handler */
  845.     g_phnset_cntx_p->ShowOPNDirtyFlag = TRUE;
  846.     if (g_phnset_cntx_p->curShowOPNStatus)
  847.     {
  848.         pfnUnicodeStrcpy((PS8) hintData[index], (PS8) GetString(STR_GLOBAL_ON));
  849.         Category52ChangeItemDescription(index, hintData[index]);
  850.         ChangeLeftSoftkey(STR_GLOBAL_OFF, 0);
  851.     }
  852.     else
  853.     {
  854.         pfnUnicodeStrcpy((PS8) hintData[index], (PS8) GetString(STR_GLOBAL_OFF));
  855.         Category52ChangeItemDescription(index, hintData[index]);
  856.         ChangeLeftSoftkey(STR_GLOBAL_ON, 0);
  857.     }
  858.     RedrawCategoryFunction();
  859.     HighlightPhnsetShowOPN();
  860. }
  861. #endif /* defined(__MMI_OPERATOR_NAME_MENU__) */ 
  862. /*****************************************************************************
  863.  * FUNCTION
  864.  *  PhnsetSetShowDTStatus
  865.  * DESCRIPTION
  866.  *  This function is to set show data time statu on/off
  867.  *  Follow functions:
  868.  * PARAMETERS
  869.  *  status      [IN]            
  870.  *  a(?)        [IN/OUT]        
  871.  *  b(?)        [IN]            
  872.  * RETURNS
  873.  *  void
  874.  *****************************************************************************/
  875. void PhnsetSetShowDTStatus(U8 status)
  876. {
  877.     /*----------------------------------------------------------------*/
  878.     /* Local Variables                                                */
  879.     /*----------------------------------------------------------------*/
  880.     /*----------------------------------------------------------------*/
  881.     /* Code Body                                                      */
  882.     /*----------------------------------------------------------------*/
  883.     g_phnset_cntx_p->curShowDtStatus = status;
  884. }
  885. /*
  886.  * ( Phonesetup-> SpeedDial -> Set Number ) functions are in speedDial.c
  887.  */
  888. /*****************************************************************************
  889.  * FUNCTION
  890.  *  HighlightPhnsetWelcomeText
  891.  * DESCRIPTION
  892.  *  This function is highlight handler for Phonesetup-> Greeting Text
  893.  *  Follow functions:
  894.  * PARAMETERS
  895.  *  void
  896.  *  a(?)        [IN/OUT]        
  897.  *  b(?)        [IN]            
  898.  * RETURNS
  899.  *  void
  900.  *****************************************************************************/
  901. void HighlightPhnsetWelcomeText(void)
  902. {
  903.     /*----------------------------------------------------------------*/
  904.     /* Local Variables                                                */
  905.     /*----------------------------------------------------------------*/
  906.     /*----------------------------------------------------------------*/
  907.     /* Code Body                                                      */
  908.     /*----------------------------------------------------------------*/
  909.     /* Change left soft key icon and label */
  910.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  911.     /* Change right soft key icon and label */
  912.     ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
  913.     /* Register function for left soft key */
  914.     SetLeftSoftkeyFunction(EntryPhnsetWelcomeText, KEY_EVENT_UP);
  915.     SetKeyHandler(EntryPhnsetWelcomeText, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  916.     /* Register function for right soft key */
  917.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  918.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  919. }
  920. /*****************************************************************************
  921.  * FUNCTION
  922.  *  PhnsetFillWelcomeInlineEditStruct
  923.  * DESCRIPTION
  924.  *  This function is to fill inline editor screen for Phonesetup-> Greeting Text
  925.  * PARAMETERS
  926.  *  pInlineStruct       [?]             
  927.  *  a(?)                [IN/OUT]        
  928.  *  b(?)                [IN]            
  929.  * RETURNS
  930.  *  void
  931.  *****************************************************************************/
  932. static void PhnsetFillWelcomeInlineEditStruct(void *pInlineStruct)
  933. {
  934.     /*----------------------------------------------------------------*/
  935.     /* Local Variables                                                */
  936.     /*----------------------------------------------------------------*/
  937.     S8 *WelcomeString = NULL;
  938.     InlineItem *InlineStruct = (InlineItem*) pInlineStruct;
  939.     /*----------------------------------------------------------------*/
  940.     /* Code Body                                                      */
  941.     /*----------------------------------------------------------------*/
  942.     WelcomeString = GetWelcomeText();
  943.     /* CurrSelect */
  944.     g_phnset_cntx_p->curHightlightItem = (U32) IsShowWelcomeScr1();
  945.     pfnUnicodeStrncpy((S8*) WelcomeText, WelcomeString, MAX_SETTING_WELCOME_TEXT);
  946.     OslMfree(WelcomeString);
  947.     greet_text_on_off[1] = (U8*) GetString(STR_GLOBAL_ON);
  948.     greet_text_on_off[0] = (U8*) GetString(STR_GLOBAL_OFF);
  949.     SetInlineItemActivation(&InlineStruct[0], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  950.     SetInlineItemCaption(&InlineStruct[0], (PU8) (U8*) GetString(STR_MENU9146_OFF));
  951.     SetInlineItemActivation(&InlineStruct[2], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  952.     SetInlineItemCaption(&InlineStruct[2], (PU8) (U8*) GetString(STR_MENU9146_ON));
  953.     SetInlineItemActivation(&InlineStruct[1], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  954.     SetInlineItemSelect(
  955.         &InlineStruct[1],
  956.         2,
  957.         greet_text_on_off,
  958.         (S32*) & (g_phnset_cntx_p->curHightlightItem) /* CurrSelect */ );
  959.     SetInlineItemActivation(&InlineStruct[3], KEY_LSK, KEY_EVENT_UP);
  960.     /* disable new line */
  961.     SetInlineItemFullScreenEdit_ext(
  962.         &InlineStruct[3],
  963.         STR_MENU9146_WELCOME_TEXT,
  964.         MAIN_MENU_TITLE_SETTINGS_ICON,
  965.         (PU8) WelcomeText,
  966.         MAX_SETTING_WELCOME_TEXT + 1,
  967.         INPUT_TYPE_ALPHANUMERIC_SENTENCECASE,
  968.         INPUT_TYPE_EXT_NO_SHOW_NEW_LINE_SYMBOL);
  969.     SetInlineFullScreenEditCustomFunction(&InlineStruct[3], SettingInlineCustomFunction);
  970. }
  971. /*****************************************************************************
  972.  * FUNCTION
  973.  *  EntryPhnsetWelcomeText
  974.  * DESCRIPTION
  975.  *  This function is Entry function for Phonesetup-> Greeting Text
  976.  *  Following functions: EntryWelcomeTextOn
  977.  * PARAMETERS
  978.  *  void
  979.  *  a(?)        [IN/OUT]        
  980.  *  b(?)        [IN]            
  981.  * RETURNS
  982.  *  void
  983.  *****************************************************************************/
  984. void EntryPhnsetWelcomeText(void)
  985. {
  986.     /*----------------------------------------------------------------*/
  987.     /* Local Variables                                                */
  988.     /*----------------------------------------------------------------*/
  989.     U16 nNumofItem = 4; /* Stores no of children in the submenu */
  990.     U8 *inputBuffer;    /* added for inline edit history */
  991.     U8 *guiBuffer;      /* Buffer holding history data */
  992.     U16 inputBufferSize;
  993.     U16 ItemIcons[4] = {IMG_SETTING_GREET_STATUS, 0, IMG_SETTING_GREET_TEXT, 0};
  994.     InlineItem greet_text_inline_edit_list[4];
  995.     /*----------------------------------------------------------------*/
  996.     /* Code Body                                                      */
  997.     /*----------------------------------------------------------------*/
  998.     EntryNewScreen(SCR9146_WELCOME_TEXT, ExitPhnsetWelcomeText, NULL, NULL);
  999.     guiBuffer = GetCurrGuiBuffer(SCR9146_WELCOME_TEXT);
  1000.     InitializeCategory57Screen();
  1001.     memset(greet_text_inline_edit_list, 0, sizeof(greet_text_inline_edit_list));
  1002.     PhnsetFillWelcomeInlineEditStruct((void*)greet_text_inline_edit_list);
  1003.     inputBuffer = GetCurrNInputBuffer(SCR9146_WELCOME_TEXT, &inputBufferSize);  /* added for inline edit history */
  1004.     if (inputBuffer != NULL)
  1005.     {
  1006.         SetCategory57Data(greet_text_inline_edit_list, nNumofItem, inputBuffer);
  1007.     }
  1008.     ClearHighlightHandler();
  1009.     ShowCategory57Screen(
  1010.         STR_MENU9146_WELCOME_TEXT,
  1011.         MAIN_MENU_TITLE_SETTINGS_ICON,
  1012.         STR_GLOBAL_OK,
  1013.         IMG_GLOBAL_OK,
  1014.         STR_GLOBAL_BACK,
  1015.         IMG_GLOBAL_BACK,
  1016.         nNumofItem,
  1017.         ItemIcons,
  1018.         greet_text_inline_edit_list,
  1019.         0,
  1020.         guiBuffer);
  1021.     /* Register function for right soft key */
  1022.     SetCategory57RightSoftkeyFunctions(EntryPhnsetWelcomeTextDoneHdlr, GoBackHistory);
  1023. }
  1024. /*****************************************************************************
  1025.  * FUNCTION
  1026.  *  ExitPhnsetWelcomeText
  1027.  * DESCRIPTION
  1028.  *  This function is Exit function for Phonesetup-> Greeting Text
  1029.  *  Following functions:
  1030.  * PARAMETERS
  1031.  *  void
  1032.  *  a(?)        [IN/OUT]        
  1033.  *  b(?)        [IN]            
  1034.  * RETURNS
  1035.  *  void
  1036.  *****************************************************************************/
  1037. void ExitPhnsetWelcomeText(void)
  1038. {
  1039.     /*----------------------------------------------------------------*/
  1040.     /* Local Variables                                                */
  1041.     /*----------------------------------------------------------------*/
  1042.     history Scr;
  1043.     S16 nHistory = 0;
  1044.     U16 inputBufferSize;    /* added for inline edit history */
  1045.     /*----------------------------------------------------------------*/
  1046.     /* Code Body                                                      */
  1047.     /*----------------------------------------------------------------*/
  1048.     Scr.scrnID = SCR9146_WELCOME_TEXT;
  1049.     CloseCategory57Screen();
  1050.     Scr.entryFuncPtr = EntryPhnsetWelcomeText;
  1051.     pfnUnicodeStrcpy((S8*) Scr.inputBuffer, (S8*) & nHistory);
  1052.     GetCategory57History(Scr.guiBuffer);
  1053.     inputBufferSize = (U16) GetCategory57DataSize();    /* added for inline edit history */
  1054.     GetCategory57Data((U8*) Scr.inputBuffer);           /* added for inline edit history */
  1055.     AddNHistory(Scr, (U16) inputBufferSize);            /* added for inline edit history */
  1056. }
  1057. /*****************************************************************************
  1058.  * FUNCTION
  1059.  *  EntryPhnsetWelcomeTextDoneHdlr
  1060.  * DESCRIPTION
  1061.  *  This function is done key handler  for Phonesetup-> Greeting Text -> Done
  1062.  *  Functionality: Query Yes/No
  1063.  *  Following functions:  PhnsetWelcomeTextDoneLskHdlr
  1064.  * PARAMETERS
  1065.  *  void
  1066.  *  a(?)        [IN/OUT]        
  1067.  *  b(?)        [IN]            
  1068.  * RETURNS
  1069.  *  void
  1070.  *****************************************************************************/
  1071. void EntryPhnsetWelcomeTextDoneHdlr(void)
  1072. {
  1073.     /*----------------------------------------------------------------*/
  1074.     /* Local Variables                                                */
  1075.     /*----------------------------------------------------------------*/
  1076.     U8 *guiBuffer;  /* Buffer holding history data */
  1077.     /*----------------------------------------------------------------*/
  1078.     /* Code Body                                                      */
  1079.     /*----------------------------------------------------------------*/
  1080.     /* Call Exit Handler */
  1081.     EntryNewScreen(SCR9146_WELCOME_TEXT_ON, NULL, NULL, NULL);
  1082.     /* Get current screen to gui buffer  for history purposes */
  1083.     guiBuffer = GetCurrGuiBuffer(SCR9146_WELCOME_TEXT_ON);
  1084.     /* Display Category1 Screen */
  1085.     DisplayConfirm(
  1086.         STR_GLOBAL_YES,
  1087.         IMG_GLOBAL_YES,
  1088.         STR_GLOBAL_NO,
  1089.         IMG_GLOBAL_NO,
  1090.         (PU16) GetString(STR_GLOBAL_SAVE),
  1091.         IMG_GLOBAL_QUESTION,
  1092.         WARNING_TONE);
  1093.     
  1094.     SetLeftSoftkeyFunction(PhnsetWelcomeTextDoneLskHdlr, KEY_EVENT_UP);
  1095.     SetRightSoftkeyFunction(GoBack2TheHistory, KEY_EVENT_UP);
  1096.     /* Play warning tone */
  1097.     playRequestedTone(WARNING_TONE);
  1098. }
  1099. /*****************************************************************************
  1100.  * FUNCTION
  1101.  *  PhnsetWelcomeTextDoneLskHdlr
  1102.  * DESCRIPTION
  1103.  *  This function is Left softkey handler
  1104.  *  for Phonesetup-> Greeting Text -> Done -> Yes
  1105.  * PARAMETERS
  1106.  *  void
  1107.  *  a(?)        [IN/OUT]        
  1108.  *  b(?)        [IN]            
  1109.  * RETURNS
  1110.  *  void
  1111.  *****************************************************************************/
  1112. void PhnsetWelcomeTextDoneLskHdlr(void)
  1113. {
  1114.     /*----------------------------------------------------------------*/
  1115.     /* Local Variables                                                */
  1116.     /*----------------------------------------------------------------*/
  1117.     S16 error;
  1118.     /*----------------------------------------------------------------*/
  1119.     /* Code Body                                                      */
  1120.     /*----------------------------------------------------------------*/
  1121.     /* ExecuteCurrExitHandler(); */
  1122.     ClearInputEventHandler(MMI_DEVICE_ALL);
  1123.     ClearKeyHandler(KEY_END, KEY_EVENT_DOWN);
  1124.     WriteValue(
  1125.         NVRAM_SETTING_WELCOME_TEXT,
  1126.         (U8*) & (g_phnset_cntx_p->curHightlightItem) /* CurrSelect */ ,
  1127.         DS_BYTE,
  1128.         &error);
  1129.     WriteRecord(
  1130.         NVRAM_EF_SETTING_LID,
  1131.         1,
  1132.         (void*)WelcomeText,
  1133.         (U16) (MAX_SETTING_WELCOME_TEXT * ENCODING_LENGTH),
  1134.         &error);
  1135. #if 0
  1136. /* under construction !*/
  1137. /* under construction !*/
  1138. /* under construction !*/
  1139. /* under construction !*/
  1140. /* under construction !*/
  1141. /* under construction !*/
  1142. /* under construction !*/
  1143. /* under construction !*/
  1144. /* under construction !*/
  1145. /* under construction !*/
  1146. /* under construction !*/
  1147. /* under construction !*/
  1148. /* under construction !*/
  1149. /* under construction !*/
  1150. /* under construction !*/
  1151. /* under construction !*/
  1152. #endif /* 0 */ 
  1153.     DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, ST_NOTIFYDURATION, SUCCESS_TONE);
  1154.     DeleteNHistory(1);
  1155. }
  1156. /*****************************************************************************
  1157.  * FUNCTION
  1158.  *  HighlightSPOF
  1159.  * DESCRIPTION
  1160.  *  This function is Highlight handler for Phonesetup->IdleScreenDisplay --> Mainmenu style
  1161.  *  Follow functions: EntryPhnsetMainMenuStyle
  1162.  * PARAMETERS
  1163.  *  void
  1164.  *  a(?)        [IN/OUT]        
  1165.  *  b(?)        [IN]            
  1166.  * RETURNS
  1167.  *  void
  1168.  *****************************************************************************/
  1169. void HighlightSPOF(void)
  1170. {
  1171.     /*----------------------------------------------------------------*/
  1172.     /* Local Variables                                                */
  1173.     /*----------------------------------------------------------------*/
  1174.     /*----------------------------------------------------------------*/
  1175.     /* Code Body                                                      */
  1176.     /*----------------------------------------------------------------*/
  1177.     /* 1 Change left soft key icon and label */
  1178.     ChangeLeftSoftkey(STR_GLOBAL_OK, 0);
  1179.     /* 2 Change right soft key icon and label */
  1180.     ChangeRightSoftkey(STR_GLOBAL_BACK, 0);
  1181.     /* 3 Register function for left soft key */
  1182. #ifdef MMI_ON_HARDWARE_P
  1183.     SetLeftSoftkeyFunction(EntrySpofApp, KEY_EVENT_UP);
  1184.     SetKeyHandler(EntrySpofApp, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1185. #else /* MMI_ON_HARDWARE_P */ 
  1186.     SetLeftSoftkeyFunction(PopupNoSupport, KEY_EVENT_UP);
  1187.     SetKeyHandler(PopupNoSupport, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1188. #endif /* MMI_ON_HARDWARE_P */ 
  1189.     /* 4 Register function for right soft key */
  1190.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1191.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1192. }
  1193. /*
  1194.  * ( Phonesetup-> SPOF ) functions are in ScheduledPowerOnOff.c
  1195.  */
  1196. /*
  1197.  * Query function begin:
  1198.  */
  1199. /*****************************************************************************
  1200.  * FUNCTION
  1201.  *  PhnsetGetShowOwnerNumStatus
  1202.  * DESCRIPTION
  1203.  *  This function is to get show owner number on/off status
  1204.  *  Functionality:
  1205.  * PARAMETERS
  1206.  *  void
  1207.  *  a(?)        [IN/OUT]        
  1208.  *  b(?)        [IN]            
  1209.  * RETURNS
  1210.  *  void
  1211.  *****************************************************************************/
  1212. MMI_BOOL PhnsetGetShowOwnerNumStatus(void)
  1213. {
  1214.     /*----------------------------------------------------------------*/
  1215.     /* Local Variables                                                */
  1216.     /*----------------------------------------------------------------*/
  1217.     U8 data = 0;
  1218.     S16 error;
  1219.     /*----------------------------------------------------------------*/
  1220.     /* Code Body                                                      */
  1221.     /*----------------------------------------------------------------*/
  1222.     ReadValue(NVRAM_SETTING_OWNER_NO, &data, DS_BYTE, &error);
  1223.     if (data == 1)
  1224.     {
  1225.         return MMI_TRUE;
  1226.     }
  1227.     else
  1228.     {
  1229.         return MMI_FALSE;
  1230.     }
  1231. }
  1232. /* Lisen 0921-1 */
  1233. #if defined(__MMI_OPERATOR_NAME_MENU__)
  1234. /*****************************************************************************
  1235.  * FUNCTION
  1236.  *  PhnsetGetShowOPNStatus
  1237.  * DESCRIPTION
  1238.  *  This function is to get show owner number on/off status
  1239.  *  Functionality:
  1240.  * PARAMETERS
  1241.  *  void
  1242.  *  a(?)        [IN/OUT]        
  1243.  *  b(?)        [IN]            
  1244.  * RETURNS
  1245.  *  void
  1246.  *****************************************************************************/
  1247. MMI_BOOL PhnsetGetShowOPNStatus(void)
  1248. {
  1249.     /*----------------------------------------------------------------*/
  1250.     /* Local Variables                                                */
  1251.     /*----------------------------------------------------------------*/
  1252.     U8 data = 0;
  1253.     S16 error;
  1254.     /*----------------------------------------------------------------*/
  1255.     /* Code Body                                                      */
  1256.     /*----------------------------------------------------------------*/
  1257.     ReadValue(NVRAM_SETTING_OPN_DISPLAY, &data, DS_BYTE, &error);
  1258.     if (data == 0)
  1259.     {
  1260.         return MMI_FALSE;
  1261.     }
  1262.     else
  1263.     {
  1264.         return MMI_TRUE;
  1265.     }
  1266. }
  1267. #endif /* defined(__MMI_OPERATOR_NAME_MENU__) */ 
  1268. /*****************************************************************************
  1269.  * FUNCTION
  1270.  *  PhnsetGetShowDateTimeStatus
  1271.  * DESCRIPTION
  1272.  *  This function is to get show date/time on/off status
  1273.  *  Functionality:
  1274.  * PARAMETERS
  1275.  *  void
  1276.  *  a(?)        [IN/OUT]        
  1277.  *  b(?)        [IN]            
  1278.  * RETURNS
  1279.  *  void
  1280.  *****************************************************************************/
  1281. MMI_BOOL PhnsetGetShowDateTimeStatus(void)
  1282. {
  1283.     /*----------------------------------------------------------------*/
  1284.     /* Local Variables                                                */
  1285.     /*----------------------------------------------------------------*/
  1286.     U8 data = 0;
  1287.     S16 error;
  1288.     /*----------------------------------------------------------------*/
  1289.     /* Code Body                                                      */
  1290.     /*----------------------------------------------------------------*/
  1291.     ReadValue(NVRAM_SETTING_STATUS_DT_TIME, &data, DS_BYTE, &error);
  1292.     if (data == 0)
  1293.     {
  1294.         return MMI_FALSE;
  1295.     }
  1296.     else
  1297.     {
  1298.         return MMI_TRUE;
  1299.     }
  1300. }
  1301. /*****************************************************************************
  1302.  * FUNCTION
  1303.  *  PhnsetSetWelcomeText
  1304.  * DESCRIPTION
  1305.  *  This function is to set welcome text for AT command
  1306.  *  Functionality:
  1307.  * PARAMETERS
  1308.  *  mode        [IN]            
  1309.  *  dcs         [IN]            
  1310.  *  text        [?]             
  1311.  *  a(?)        [IN/OUT]        
  1312.  *  b(?)        [IN]            
  1313.  * RETURNS
  1314.  *  void
  1315.  *****************************************************************************/
  1316. MMI_BOOL PhnsetSetWelcomeText(MMI_BOOL mode, U8 dcs, U8 *text, U8 length)
  1317. {
  1318.     /*----------------------------------------------------------------*/
  1319.     /* Local Variables                                                */
  1320.     /*----------------------------------------------------------------*/
  1321.     S16 error;
  1322.     S32 AtMode;
  1323.     /*----------------------------------------------------------------*/
  1324.     /* Code Body                                                      */
  1325.     /*----------------------------------------------------------------*/
  1326.     if (length != 0xFF)
  1327.     {
  1328.         U8 AtWelcomeText[(MAX_SETTING_WELCOME_TEXT + 1) * ENCODING_LENGTH];
  1329.         memset(AtWelcomeText, 0, sizeof(AtWelcomeText));
  1330.         if (dcs == L4_ASCII)
  1331.         {
  1332.             AnsiiNToUnicodeString((S8*) AtWelcomeText, (S8*) text, MAX_SETTING_WELCOME_TEXT);
  1333.         }
  1334.         else if (dcs == L4_UCS2)
  1335.         {
  1336.             memcpy(AtWelcomeText, text, sizeof(AtWelcomeText));
  1337.         }
  1338.         WriteRecord(
  1339.             NVRAM_EF_SETTING_LID,
  1340.             1,
  1341.             (void*)AtWelcomeText,
  1342.             (U16) (MAX_SETTING_WELCOME_TEXT * ENCODING_LENGTH),
  1343.             &error);
  1344.             
  1345.         if (error != NVRAM_WRITE_SUCCESS)
  1346.         {
  1347.             return MMI_FALSE;
  1348.         }
  1349.     }
  1350.     if (mode == 0)
  1351.     {
  1352.         AtMode = 0;
  1353.     }
  1354.     else
  1355.     {
  1356.         AtMode = 1;
  1357.     }
  1358.     WriteValue(NVRAM_SETTING_WELCOME_TEXT, (U8*) & AtMode, DS_BYTE, &error);
  1359.     if (error != NVRAM_WRITE_SUCCESS)
  1360.     {
  1361.         return MMI_FALSE;
  1362.     }
  1363.     return MMI_TRUE;
  1364. }
  1365. /*****************************************************************************
  1366.  * FUNCTION
  1367.  *  PhnsetGetWelcomeText
  1368.  * DESCRIPTION
  1369.  *  This function is to get welcome text for AT command
  1370.  *  Functionality:
  1371.  * PARAMETERS
  1372.  *  buf             [?]             
  1373.  *  buf_size        [IN]            
  1374.  *  a(?)            [IN/OUT]        
  1375.  *  b(?)            [IN]            
  1376.  * RETURNS
  1377.  *  void
  1378.  *****************************************************************************/
  1379. void PhnsetGetWelcomeText(S8 *buf, U16 buf_size)
  1380. {
  1381.     /*----------------------------------------------------------------*/
  1382.     /* Local Variables                                                */
  1383.     /*----------------------------------------------------------------*/
  1384.     S16 error;
  1385.     U8 data[(MAX_SETTING_WELCOME_TEXT + 1) * ENCODING_LENGTH];
  1386.     U16 max_buf_size;
  1387.     /*----------------------------------------------------------------*/
  1388.     /* Code Body                                                      */
  1389.     /*----------------------------------------------------------------*/
  1390.     memset(data, 0, sizeof(data));
  1391.     ReadRecord(NVRAM_EF_SETTING_LID, 1, data, (MAX_SETTING_WELCOME_TEXT * ENCODING_LENGTH), &error);
  1392.     if (buf_size < (MAX_SETTING_WELCOME_TEXT + 1) * ENCODING_LENGTH)
  1393.     {
  1394.         max_buf_size = buf_size;
  1395.     }
  1396.     else
  1397.     {
  1398.         max_buf_size = (MAX_SETTING_WELCOME_TEXT + 1) * ENCODING_LENGTH;
  1399.     }
  1400.     memset(buf, 0, buf_size);
  1401.     if (data[0] != 0xFF)
  1402.     {
  1403.         memcpy(buf, data, (max_buf_size - ENCODING_LENGTH));
  1404.     }
  1405. }
  1406. /*
  1407.  * Hint Handler begin:
  1408.  */
  1409. /*****************************************************************************
  1410.  * FUNCTION
  1411.  *  HintPhnsetLanguage
  1412.  * DESCRIPTION
  1413.  *  This function is hint handling function
  1414.  *  for Phonesetup -> Language
  1415.  *  Functionality:
  1416.  * PARAMETERS
  1417.  *  index       [IN]            
  1418.  *  a(?)        [IN/OUT]        
  1419.  *  b(?)        [IN]            
  1420.  * RETURNS
  1421.  *  void
  1422.  *****************************************************************************/
  1423. void HintPhnsetLanguage(U16 index)
  1424. {
  1425.     /*----------------------------------------------------------------*/
  1426.     /* Local Variables                                                */
  1427.     /*----------------------------------------------------------------*/
  1428.     S16 error;
  1429.     U8 data = 0;
  1430.     /*----------------------------------------------------------------*/
  1431.     /* Code Body                                                      */
  1432.     /*----------------------------------------------------------------*/
  1433.     ReadValue(NVRAM_SETTING_LANG, &data, DS_BYTE, &error);
  1434. #ifdef __MMI_AUTO_LANG_EN__
  1435.     if (data == 0xFF)   /* Auto Language Selected */
  1436.     {
  1437.         pfnUnicodeStrcpy((PS8) hintData[index], (PS8) GetString(STR_LANGUAGESCR_AUTO));
  1438.     }
  1439.     else
  1440. #endif /* __MMI_AUTO_LANG_EN__ */ 
  1441.     {
  1442.         pfnUnicodeStrcpy((PS8) hintData[index], (PS8) gLanguageArray[data].aName);
  1443.     }
  1444. }
  1445. /*****************************************************************************
  1446.  * FUNCTION
  1447.  *  HintPhnsetPreferedInputMethod
  1448.  * DESCRIPTION
  1449.  *  This function is hint handling function
  1450.  *  for Phonesetup -> Language
  1451.  *  Functionality:
  1452.  * PARAMETERS
  1453.  *  index       [IN]            
  1454.  *  a(?)        [IN/OUT]        
  1455.  *  b(?)        [IN]            
  1456.  * RETURNS
  1457.  *  void
  1458.  *****************************************************************************/
  1459. #ifdef __MMI_PREFER_INPUT_METHOD__
  1460. void HintPhnsetPreferedInputMethod(U16 index)
  1461. {
  1462.     /*----------------------------------------------------------------*/
  1463.     /* Local Variables                                                */
  1464.     /*----------------------------------------------------------------*/
  1465.     S16 error;
  1466.     U16 data = 0;
  1467.     /*----------------------------------------------------------------*/
  1468.     /* Code Body                                                      */
  1469.     /*----------------------------------------------------------------*/
  1470.     ReadValue(NVRAM_SETTING_PREFER_INPUT_METHOD, &data, DS_SHORT, &error);
  1471.     InitPreferedInputMethod();
  1472.     pfnUnicodeStrcpy((PS8) hintData[index], (PS8) inputMethodList[GetInputMethodIndex(data)]);
  1473. }
  1474. #endif /* __MMI_PREFER_INPUT_METHOD__ */ 
  1475. #if defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__)
  1476. /*****************************************************************************
  1477.  * FUNCTION
  1478.  *  HighlightHandwritingSetting
  1479.  * DESCRIPTION
  1480.  *  This function is highlight handler for Handwriting setting screen
  1481.  * PARAMETERS
  1482.  *  void
  1483.  * RETURNS
  1484.  *  void
  1485.  *****************************************************************************/
  1486. void HighlightHandwritingSetting(void)
  1487. {
  1488.     /*----------------------------------------------------------------*/
  1489.     /* Local Variables                                                */
  1490.     /*----------------------------------------------------------------*/
  1491.     /*----------------------------------------------------------------*/
  1492.     /* Code Body                                                      */
  1493.     /*----------------------------------------------------------------*/
  1494.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  1495.     ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
  1496.     SetLeftSoftkeyFunction(EntryHandWritingSettingScr, KEY_EVENT_UP);
  1497.     SetKeyHandler(EntryHandWritingSettingScr, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1498.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1499.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1500. }
  1501. /*****************************************************************************
  1502.  * FUNCTION
  1503.  *  HighlightCalibrationSetting
  1504.  * DESCRIPTION
  1505.  *  This function is highlight handler for Calibration setting screen
  1506.  * PARAMETERS
  1507.  *  void
  1508.  * RETURNS
  1509.  *  void
  1510.  *****************************************************************************/
  1511. void HighlightCalibrationSetting(void)
  1512. {
  1513.     /*----------------------------------------------------------------*/
  1514.     /* Local Variables                                                */
  1515.     /*----------------------------------------------------------------*/
  1516.     /*----------------------------------------------------------------*/
  1517.     /* Code Body                                                      */
  1518.     /*----------------------------------------------------------------*/
  1519.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  1520.     ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
  1521.     SetLeftSoftkeyFunction(EntryCalibrationSettingScr, KEY_EVENT_UP);
  1522.     SetKeyHandler(EntryCalibrationSettingScr, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1523.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1524.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1525. }
  1526. /*****************************************************************************
  1527.  * FUNCTION
  1528.  *  SaveHandwritingSetting
  1529.  * DESCRIPTION
  1530.  *  This function saves pen setting in Settings->PhoneSetup->PenSetting screen
  1531.  *  Functionality:
  1532.  * PARAMETERS
  1533.  *  void
  1534.  * RETURNS
  1535.  *  void
  1536.  *****************************************************************************/
  1537. void SaveHandwritingSetting(void)
  1538. {
  1539.     /*----------------------------------------------------------------*/
  1540.     /* Local Variables                                                */
  1541.     /*----------------------------------------------------------------*/
  1542.     S16 pError;
  1543.     /*----------------------------------------------------------------*/
  1544.     /* Code Body                                                      */
  1545.     /*----------------------------------------------------------------*/
  1546.     g_phnset_cntx_p->pen_speed = gInlinePenSpeed;
  1547.     g_phnset_cntx_p->pen_color = gInlinePenColorIndex;
  1548.     WriteValue(NVRAM_PEN_SPEED, &(g_phnset_cntx_p->pen_speed), DS_BYTE, &pError);
  1549.     if (pError != NVRAM_WRITE_SUCCESS)
  1550.     {
  1551.         PRINT_INFORMATION(("NVRAM PenSetting Write Failed. Error -%d", pError));
  1552.     }
  1553.     WriteValue(NVRAM_PEN_COLOR, &(g_phnset_cntx_p->pen_color), DS_BYTE, &pError);
  1554.     if (pError != NVRAM_WRITE_SUCCESS)
  1555.     {
  1556.         PRINT_INFORMATION(("NVRAM Pen Setting Write Failed. Error -%d", pError));
  1557.     }
  1558.     GoBeyondMarkerScr(SCR_HANDWRITING_SETTING);
  1559. }
  1560. /*****************************************************************************
  1561.  * FUNCTION
  1562.  *  GoBackHandwritingSettingConfirm
  1563.  * DESCRIPTION
  1564.  *  This function exits pen setting screen when user doesn't save pen settings after changing in Settings->PhoneSetup->PenSetting screen
  1565.  *  Functionality:
  1566.  * PARAMETERS
  1567.  *  void
  1568.  * RETURNS
  1569.  *  void
  1570.  *****************************************************************************/
  1571. void GoBackHandwritingSettingConfirm(void)
  1572. {
  1573.     /*----------------------------------------------------------------*/
  1574.     /* Local Variables                                                */
  1575.     /*----------------------------------------------------------------*/
  1576.     /*----------------------------------------------------------------*/
  1577.     /* Code Body                                                      */
  1578.     /*----------------------------------------------------------------*/
  1579.     GoBeyondMarkerScr(SCR_HANDWRITING_SETTING);
  1580. }
  1581. /*****************************************************************************
  1582.  * FUNCTION
  1583.  *  EntryScrHandwritingSettingConfirm
  1584.  * DESCRIPTION
  1585.  *  This function displays pop up to confirm pen settings change before saving them in Settings->PhoneSetup->PenSetting screen
  1586.  *  Functionality:
  1587.  * PARAMETERS
  1588.  *  void
  1589.  *  a(?)        [IN/OUT]        
  1590.  *  b(?)        [IN]            
  1591.  * RETURNS
  1592.  *  void
  1593.  *****************************************************************************/
  1594. void EntryScrHandwritingSettingConfirm(void)
  1595. {
  1596.     /*----------------------------------------------------------------*/
  1597.     /* Local Variables                                                */
  1598.     /*----------------------------------------------------------------*/
  1599.     /*----------------------------------------------------------------*/
  1600.     /* Code Body                                                      */
  1601.     /*----------------------------------------------------------------*/
  1602.     DisplayConfirm(
  1603.         STR_GLOBAL_YES,
  1604.         IMG_GLOBAL_YES,
  1605.         STR_GLOBAL_NO,
  1606.         IMG_GLOBAL_NO,
  1607.         get_string(STR_GLOBAL_SAVE),
  1608.         IMG_GLOBAL_QUESTION,
  1609.         WARNING_TONE);
  1610.     SetLeftSoftkeyFunction(SaveHandwritingSetting, KEY_EVENT_UP);
  1611.     SetRightSoftkeyFunction(GoBackHandwritingSettingConfirm, KEY_EVENT_UP);
  1612. }
  1613. /*****************************************************************************
  1614.  * FUNCTION
  1615.  *  HandwritingSettingInlineColor
  1616.  * DESCRIPTION
  1617.  *  This function updates softkey and iInlinePen color according to change in Pen Color
  1618.  * PARAMETERS
  1619.  *  index       [IN]        
  1620.  *  a(?)        [IN]        
  1621.  *  b(?)        [OUT]       
  1622.  * RETURNS
  1623.  *  void
  1624.  *****************************************************************************/
  1625. void HandwritingSettingInlineColor(U16 index)
  1626. {
  1627.     /*----------------------------------------------------------------*/
  1628.     /* Local Variables                                                */
  1629.     /*----------------------------------------------------------------*/
  1630.     /*----------------------------------------------------------------*/
  1631.     /* Code Body                                                      */
  1632.     /*----------------------------------------------------------------*/
  1633.     if (index < MAX_PEN_COLORS)
  1634.     {
  1635.         if (index != gInlinePenColorIndex)
  1636.         {
  1637.             set_wgui_inline_list_menu_changed();
  1638.         }
  1639.         gInlinePenColorIndex = index;
  1640.     }
  1641. }
  1642. /*****************************************************************************
  1643.  * FUNCTION
  1644.  *  EntryHandWritingSettingScr
  1645.  * DESCRIPTION
  1646.  *  Entry function for Pen Setting Screen
  1647.  * PARAMETERS
  1648.  *  void
  1649.  *  a(?)        [IN]        
  1650.  *  b(?)        [OUT]       
  1651.  * RETURNS
  1652.  *  void
  1653.  *****************************************************************************/
  1654. void EntryHandWritingSettingScr(void)
  1655. {
  1656.     /*----------------------------------------------------------------*/
  1657.     /* Local Variables                                                */
  1658.     /*----------------------------------------------------------------*/
  1659.     U8 *guiBuffer;
  1660.     U8 *inputBuffer;
  1661.     U16 inputBufferSize;
  1662.     U16 list_of_icons[4];
  1663.     S32 iCount;
  1664.     S16 item_offset = 0;
  1665.     /*----------------------------------------------------------------*/
  1666.     /* Code Body                                                      */
  1667.     /*----------------------------------------------------------------*/
  1668.     EntryNewScreen(SCR_HANDWRITING_SETTING, ExitHandWritingSettingScr, NULL, NULL);
  1669.     guiBuffer = GetCurrGuiBuffer(SCR_HANDWRITING_SETTING);
  1670.     inputBuffer = GetCurrNInputBuffer(SCR_HANDWRITING_SETTING, &inputBufferSize);
  1671.     for (iCount = 0; iCount < MAX_PEN_SPEED; ++iCount)
  1672.     {
  1673.         g_pen_speed_str_list[iCount] = (U8*) GetString((U16) (iCount + STR_HANDWRITING_FAST));
  1674.     }
  1675.     gInlinePenSpeed = g_phnset_cntx_p->pen_speed;
  1676.     gInlinePenColorIndex = g_phnset_cntx_p->pen_color;
  1677.     /* start of Category 57 */
  1678.     InitializeCategory57Screen();
  1679.     /* Pen speed */
  1680.     SetInlineItemCaption(&wgui_inline_items[item_offset++], (PU8) GetString(STR_HANDWRITING_PEN_SPEED));
  1681.     SetInlineItemActivation(&wgui_inline_items[item_offset], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  1682.     SetInlineItemSelect(&wgui_inline_items[item_offset++], MAX_PEN_SPEED, g_pen_speed_str_list, &gInlinePenSpeed);
  1683.     /* Pen Color */
  1684.     SetInlineItemCaption(&wgui_inline_items[item_offset++], (PU8) GetString(STR_HANDWRITING_PEN_COLOR));
  1685.     SetInlineItemActivation(&wgui_inline_items[item_offset], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  1686.     SetInlineItemColorSelect(
  1687.         &wgui_inline_items[item_offset++],
  1688.         MAX_PEN_COLORS,
  1689.         (U16) gInlinePenColorIndex,
  1690.         (color*) g_pen_color_list,
  1691.         HandwritingSettingInlineColor);
  1692.     if (inputBuffer != NULL)
  1693.     {
  1694.         SetCategory57Data(wgui_inline_items, item_offset, inputBuffer);
  1695.     }
  1696.     list_of_icons[0] = IMG_GLOBAL_L1;
  1697.     list_of_icons[1] = 0;
  1698.     list_of_icons[2] = IMG_GLOBAL_L2;
  1699.     list_of_icons[3] = 0;
  1700.     ShowCategory57Screen(
  1701.         STR_HANDWRITING_SETTING,
  1702.         GetRootTitleIcon(MENU_SETTING_HANDWRITING),
  1703.         STR_GLOBAL_OK,
  1704.         IMG_GLOBAL_OK,
  1705.         STR_GLOBAL_BACK,
  1706.         IMG_GLOBAL_BACK,
  1707.         item_offset,
  1708.         list_of_icons,
  1709.         wgui_inline_items,
  1710.         0,
  1711.         guiBuffer);
  1712.     SetCategory57RightSoftkeyFunctions(EntryScrHandwritingSettingConfirm, GoBackHistory);
  1713. }
  1714. /*****************************************************************************
  1715.  * FUNCTION
  1716.  *  ExitHandWritingSettingScr
  1717.  * DESCRIPTION
  1718.  *  Exit function for Pen Setting Screen
  1719.  * PARAMETERS
  1720.  *  void
  1721.  *  a(?)        [IN]        
  1722.  *  b(?)        [OUT]       
  1723.  * RETURNS
  1724.  *  void
  1725.  *****************************************************************************/
  1726. void ExitHandWritingSettingScr(void)
  1727. {
  1728.     /*----------------------------------------------------------------*/
  1729.     /* Local Variables                                                */
  1730.     /*----------------------------------------------------------------*/
  1731.     history h;
  1732.     U16 inputBufferSize;
  1733.     /*----------------------------------------------------------------*/
  1734.     /* Code Body                                                      */
  1735.     /*----------------------------------------------------------------*/
  1736.     CloseCategory57Screen();
  1737.     h.scrnID = SCR_HANDWRITING_SETTING;
  1738.     h.entryFuncPtr = EntryHandWritingSettingScr;
  1739.     GetCategoryHistory(h.guiBuffer);
  1740.     inputBufferSize = (U16) GetCategory57DataSize();
  1741.     GetCategory57Data((U8*) h.inputBuffer);
  1742.     AddNHistory(h, inputBufferSize);
  1743. }
  1744. /*****************************************************************************
  1745.  * FUNCTION
  1746.  *  WriteNvramCalibrationData
  1747.  * DESCRIPTION
  1748.  *  Writes calibration setting in NVRAM
  1749.  * PARAMETERS
  1750.  *  calibration_data        [IN]        
  1751.  * RETURNS
  1752.  *  void
  1753.  * REMARKS
  1754.  *  This function assumes that NVRAM Values of Calibration data are stored in
  1755.  *  a fixed order in NVRAMEnum.h file . Order should not be changed.
  1756.  *  
  1757.  *  It is not atomic operation between ReadRecord and WriteRecord, but it's okay.
  1758.  *****************************************************************************/
  1759. static void WriteNvramCalibrationData(mmi_pen_calibration_struct *calibration_data)
  1760. {
  1761.     /*----------------------------------------------------------------*/
  1762.     /* Local Variables                                                */
  1763.     /*----------------------------------------------------------------*/
  1764.     U8 tempBuffer[NVRAM_CACHE_SIZE];
  1765.     S16 pError = 0;
  1766.     /*----------------------------------------------------------------*/
  1767.     /* Code Body                                                      */
  1768.     /*----------------------------------------------------------------*/
  1769.     /* Note: It is not atomic operation between ReadRecord and WriteRecord. */
  1770.     if (ReadRecord(NVRAM_EF_CACHE_DOUBLE_LID, 1, tempBuffer, NVRAM_CACHE_SIZE, &pError) < 0)
  1771.     {
  1772.         PRINT_INFORMATION(("Calibration NVRAM data read failed , Error = %d", (int)pError));
  1773.         /* Do some error handling */
  1774.     }
  1775.     else
  1776.     {
  1777.         S16 i, j;
  1778.         for (i = NVRAM_PEN_CALIBRATION_VALUE1, j = 0; i <= NVRAM_PEN_CALIBRATION_VALUE1 + PEN_CALIBRATION_DATA_SIZE - 1;
  1779.              i++, j++)
  1780.         {
  1781.             memcpy(&tempBuffer[i * DS_DOUBLE], &calibration_data->data[j], DS_DOUBLE);
  1782.         }
  1783.         WriteRecord(NVRAM_EF_CACHE_DOUBLE_LID, 1, tempBuffer, NVRAM_CACHE_SIZE, &pError);
  1784.     }
  1785.     g_phnset_cntx_p->is_default_calibration_set = MMI_TRUE;
  1786. }
  1787. /*****************************************************************************
  1788.  * FUNCTION
  1789.  *  WriteNvramFactoryDefaultCalibrationData
  1790.  * DESCRIPTION
  1791.  *  Writes factory default calibration setting in NVRAM
  1792.  * PARAMETERS
  1793.  *  calibration_data        [IN]        
  1794.  * RETURNS
  1795.  *  void
  1796.  * REMARKS
  1797.  *  This function assumes that NVRAM Values of Calibration data are stored in
  1798.  *  a fixed order in NVRAMEnum.h file . Order should not be changed.
  1799.  *  
  1800.  *  It is not atomic operation between ReadRecord and WriteRecord, but it's okay.
  1801.  *****************************************************************************/
  1802. static void WriteNvramFactoryDefaultCalibrationData(mmi_pen_calibration_struct *calibration_data)
  1803. {
  1804.     /*----------------------------------------------------------------*/
  1805.     /* Local Variables                                                */
  1806.     /*----------------------------------------------------------------*/
  1807.     U8 tempBuffer[NVRAM_CACHE_SIZE];
  1808.     S16 pError = 0;
  1809.     /*----------------------------------------------------------------*/
  1810.     /* Code Body                                                      */
  1811.     /*----------------------------------------------------------------*/
  1812.     /* Note: It is not atomic operation between ReadRecord and WriteRecord. */
  1813.     if (ReadRecord(NVRAM_EF_CACHE_DOUBLE_LID, 1, tempBuffer, NVRAM_CACHE_SIZE, &pError) < 0)
  1814.     {
  1815.         PRINT_INFORMATION(("Calibration NVRAM data read failed , Error = %d", (int)pError));
  1816.         /* Do some error handling */
  1817.     }
  1818.     else
  1819.     {
  1820.         S16 i, j;
  1821.         for (i = NVRAM_RESTORE_DEFAULT_PEN_CALIBRATION_VALUE1, j = 0;
  1822.              i <= NVRAM_RESTORE_DEFAULT_PEN_CALIBRATION_VALUE1 + PEN_CALIBRATION_DATA_SIZE - 1; i++, j++)
  1823.         {
  1824.             memcpy(&tempBuffer[i * DS_DOUBLE], &calibration_data->data[j], DS_DOUBLE);
  1825.         }
  1826.         WriteRecord(NVRAM_EF_CACHE_DOUBLE_LID, 1, tempBuffer, NVRAM_CACHE_SIZE, &pError);
  1827.     }
  1828.     g_phnset_cntx_p->is_default_calibration_set = MMI_TRUE;
  1829. }
  1830. /*****************************************************************************
  1831.  * FUNCTION
  1832.  *  ValidateNvramCalibrationData
  1833.  * DESCRIPTION
  1834.  *  Function to validate calibration data read from NVRAM
  1835.  * PARAMETERS
  1836.  *  buffer          [?]         
  1837.  *  start_index     [IN]        
  1838.  *  end_index       [IN]        
  1839.  *  a(?)            [IN]        U8* , S16, S16
  1840.  *  b(?)            [OUT]       BOOL
  1841.  * RETURNS
  1842.  *  void
  1843.  *****************************************************************************/
  1844. static BOOL ValidateNvramCalibrationData(U8 *buffer, S16 start_index, S16 end_index)
  1845. {
  1846.     /*----------------------------------------------------------------*/
  1847.     /* Local Variables                                                */
  1848.     /*----------------------------------------------------------------*/
  1849.     S32 i;
  1850.     unsigned char default_value[] = "xFFxFFxFFxFFxFFxFFxFFxFF";
  1851.     /*----------------------------------------------------------------*/
  1852.     /* Code Body                                                      */
  1853.     /*----------------------------------------------------------------*/
  1854.     for (i = start_index; i <= end_index; i++)
  1855.     {
  1856.         if (memcmp(&buffer[i * DS_DOUBLE], default_value, DS_DOUBLE))
  1857.         {
  1858.             return MMI_TRUE;
  1859.         }
  1860.     }
  1861.     return MMI_FALSE;
  1862. }
  1863. /*****************************************************************************
  1864.  * FUNCTION
  1865.  *  PhnsetReadNvramCalibrationData
  1866.  * DESCRIPTION
  1867.  *  Function to read calibration data from NVRAM
  1868.  * PARAMETERS
  1869.  *  void
  1870.  * RETURNS
  1871.  *  void
  1872.  *****************************************************************************/
  1873. void PhnsetReadNvramCalibrationData(void)
  1874. {
  1875.     /*----------------------------------------------------------------*/
  1876.     /* Local Variables                                                */
  1877.     /*----------------------------------------------------------------*/
  1878.     U8 tempBuffer[NVRAM_CACHE_SIZE];
  1879.     S16 pError = 0;
  1880.     /*----------------------------------------------------------------*/
  1881.     /* Code Body                                                      */
  1882.     /*----------------------------------------------------------------*/
  1883.     g_phnset_cntx_p->is_default_calibration_set = MMI_FALSE;
  1884.     if (ReadRecord(NVRAM_EF_CACHE_DOUBLE_LID, 1, tempBuffer, NVRAM_CACHE_SIZE, &pError) < 0)
  1885.     {
  1886.         PRINT_INFORMATION(("Calibration NVRAM data read failed , Error = %d", (int)pError));
  1887.         /* Do nothing, driver will take care */
  1888.         return;
  1889.     }
  1890.     else
  1891.     {
  1892.         S16 i, j;
  1893.         mmi_pen_calibration_struct calibration_data;
  1894.         if (ValidateNvramCalibrationData
  1895.             (tempBuffer, NVRAM_PEN_CALIBRATION_VALUE1, NVRAM_PEN_CALIBRATION_VALUE1 + PEN_CALIBRATION_DATA_SIZE - 1))
  1896.         {
  1897.             /* Use user-calibrated data */
  1898.             for (i = NVRAM_PEN_CALIBRATION_VALUE1, j = 0;
  1899.                  i <= NVRAM_PEN_CALIBRATION_VALUE1 + PEN_CALIBRATION_DATA_SIZE - 1; i++, j++)
  1900.             {
  1901.                 memcpy(&calibration_data.data[j], &tempBuffer[i * DS_DOUBLE], DS_DOUBLE);
  1902.             }
  1903.             mmi_pen_set_calibration_data(&calibration_data);
  1904.             g_phnset_cntx_p->is_default_calibration_set = MMI_TRUE;
  1905.             return;
  1906.         }
  1907.         else
  1908.         {
  1909.             /* Use factory default data */
  1910.             if (ValidateNvramCalibrationData
  1911.                 (tempBuffer, NVRAM_RESTORE_DEFAULT_PEN_CALIBRATION_VALUE1,
  1912.                  NVRAM_RESTORE_DEFAULT_PEN_CALIBRATION_VALUE1 + PEN_CALIBRATION_DATA_SIZE - 1))
  1913.             {
  1914.                 for (i = NVRAM_RESTORE_DEFAULT_PEN_CALIBRATION_VALUE1, j = 0;
  1915.                      i <= NVRAM_RESTORE_DEFAULT_PEN_CALIBRATION_VALUE1 + PEN_CALIBRATION_DATA_SIZE - 1; i++, j++)
  1916.                 {
  1917.                     memcpy(&calibration_data.data[j], &tempBuffer[i * DS_DOUBLE], DS_DOUBLE);
  1918.                 }
  1919.                 mmi_pen_set_calibration_data(&calibration_data);
  1920.                 g_phnset_cntx_p->is_default_calibration_set = MMI_TRUE;
  1921.                 return;
  1922.             }
  1923.         }
  1924.         PRINT_INFORMATION(("NVRAM Calibration Data not found"));
  1925.         /* Do nothing, driver will take care */
  1926.     }
  1927. }
  1928. #if 0
  1929. /* under construction !*/
  1930. /* under construction !*/
  1931. /* under construction !*/
  1932. /* under construction !*/
  1933. /* under construction !*/
  1934. /* under construction !*/
  1935. /* under construction !*/
  1936. /* under construction !*/
  1937. /* under construction !*/
  1938. /* under construction !*/
  1939. /* under construction !*/
  1940. /* under construction !*/
  1941. /* under construction !*/
  1942. /* under construction !*/
  1943. /* under construction !*/
  1944. /* under construction !*/
  1945. /* under construction !*/
  1946. /* under construction !*/
  1947. /* under construction !*/
  1948. /* under construction !*/
  1949. /* under construction !*/
  1950. /* under construction !*/
  1951. /* under construction !*/
  1952. /* under construction !*/
  1953. /* under construction !*/
  1954. /* under construction !*/
  1955. /* under construction !*/
  1956. #endif /* 0 */ 
  1957. /*****************************************************************************
  1958.  * FUNCTION
  1959.  *  CalibrationSettingRestoreData
  1960.  * DESCRIPTION
  1961.  *  Restores calibration setting if user is not able to set calibration data properly
  1962.  * PARAMETERS
  1963.  *  void
  1964.  * RETURNS
  1965.  *  void
  1966.  *****************************************************************************/
  1967. static void CalibrationSettingRestoreData(void)
  1968. {
  1969.     /*----------------------------------------------------------------*/
  1970.     /* Local Variables                                                */
  1971.     /*----------------------------------------------------------------*/
  1972.     /*----------------------------------------------------------------*/
  1973.     /* Code Body                                                      */
  1974.     /*----------------------------------------------------------------*/
  1975.     mmi_pen_set_calibration_data(&g_phnset_calibration_cntx_p->backup_data);
  1976. }
  1977. /*****************************************************************************
  1978.  * FUNCTION
  1979.  *  CalibrationSettingPenDown
  1980.  * DESCRIPTION
  1981.  *  PenDown Handler for Calibration Setting Screen
  1982.  * PARAMETERS
  1983.  *  point       [IN]        
  1984.  * RETURNS
  1985.  *  void
  1986.  *****************************************************************************/
  1987. static void CalibrationSettingPenDown(mmi_pen_point_struct point)
  1988. {
  1989.     /*----------------------------------------------------------------*/
  1990.     /* Local Variables                                                */
  1991.     /*----------------------------------------------------------------*/
  1992.     /*----------------------------------------------------------------*/
  1993.     /* Code Body                                                      */
  1994.     /*----------------------------------------------------------------*/
  1995.     switch (g_phnset_calibration_screen_state)
  1996.     {
  1997.         case CALIBRATION_WELCOME_STATE:
  1998.             g_phnset_calibration_screen_state = CALIBRATION_TOP_LEFT_POINT_STATE;
  1999.             UpdateCalibrationScreen(
  2000.                 IMG_CALIBRATION_TOP_LEFT,
  2001.                 g_phnset_calibration_cntx_p->points[0].x,
  2002.                 g_phnset_calibration_cntx_p->points[0].y,
  2003.                 STR_CALIBRATION_TOP_LEFT_TEXT,
  2004.                 CALIBRATION_TOP_LEFT_POINT_STATE,
  2005.                 MMI_TRUE);
  2006.             mmi_pen_start_calibration(NUM_CALIBRATION_POINTS, g_phnset_calibration_cntx_p->points);
  2007.             break;
  2008.         case CALIBRATION_TOP_LEFT_POINT_STATE:
  2009.             g_phnset_calibration_screen_state = CALIBRATION_BOTTOM_RIGHT_POINT_STATE;
  2010.             UpdateCalibrationScreen(
  2011.                 IMG_CALIBRAION_BOTTOM_RIGHT,
  2012.                 g_phnset_calibration_cntx_p->points[1].x,
  2013.                 g_phnset_calibration_cntx_p->points[1].y,
  2014.                 STR_CALIBRATION_BOTTOM_RIGHT_TEXT,
  2015.                 CALIBRATION_BOTTOM_RIGHT_POINT_STATE,
  2016.                 MMI_TRUE);
  2017.             break;
  2018.         case CALIBRATION_BOTTOM_RIGHT_POINT_STATE:
  2019.             g_phnset_calibration_screen_state = CALIBRATION_CENTER_POINT_STATE;
  2020.             UpdateCalibrationScreen(
  2021.                 IMG_CALIBRATION_CENTER,
  2022.                 g_phnset_calibration_cntx_p->points[2].x,
  2023.                 g_phnset_calibration_cntx_p->points[2].y,
  2024.                 STR_CALIBRATION_CENTER_TEXT,
  2025.                 CALIBRATION_CENTER_POINT_STATE,
  2026.                 MMI_TRUE);
  2027.             break;
  2028.         case CALIBRATION_CENTER_POINT_STATE:
  2029.     #ifndef __MTK_TARGET__  /* Emulate driver's response */
  2030.         {
  2031.             mmi_pen_calibration_struct calibration_data;
  2032.             g_phnset_calibration_cntx_p->finished = MMI_TRUE;
  2033.             /* Write calibration data in NVRAM */
  2034.             mmi_pen_read_calibration_data(&calibration_data);
  2035.             if (g_phnset_calibration_cntx_p->save_to_factory_default)
  2036.             {
  2037.                 WriteNvramFactoryDefaultCalibrationData(&calibration_data);
  2038.             }
  2039.             else
  2040.             {
  2041.                 WriteNvramCalibrationData(&calibration_data);
  2042.             }
  2043.             if (g_phnset_calibration_cntx_p->finish_callback)
  2044.             {
  2045.                 DisplayPopupCallBack(
  2046.                     (U8*) GetString(STR_GLOBAL_DONE),
  2047.                     IMG_GLOBAL_ACTIVATED,
  2048.                     MMI_FALSE,
  2049.                     UI_POPUP_NOTIFYDURATION_TIME,
  2050.                     (U8) SUCCESS_TONE,
  2051.                     g_phnset_calibration_cntx_p->finish_callback);
  2052.             }
  2053.             else
  2054.             {
  2055.                 DisplayPopup(
  2056.                     (U8*) GetString(STR_GLOBAL_DONE),
  2057.                     IMG_GLOBAL_ACTIVATED,
  2058.                     MMI_FALSE,
  2059.                     UI_POPUP_NOTIFYDURATION_TIME,
  2060.                     (U8) SUCCESS_TONE);
  2061.             }
  2062.         }
  2063.     #endif /* __MTK_TARGET__ */ 
  2064.             break;
  2065.         default:
  2066.             MMI_ASSERT(0);
  2067.             break;
  2068.     }
  2069. }
  2070. /*****************************************************************************
  2071.  * FUNCTION
  2072.  *  PhnsetCalibrationDriverRsp
  2073.  * DESCRIPTION
  2074.  *  Protocol event handler of driver response
  2075.  * PARAMETERS
  2076.  *  msg     [IN]        Local parameter
  2077.  * RETURNS
  2078.  *  void
  2079.  *****************************************************************************/
  2080. #ifdef __MTK_TARGET__
  2081. void PhnsetCalibrationDriverRsp(void *msg)
  2082. {
  2083.     /*----------------------------------------------------------------*/
  2084.     /* Local Variables                                                */
  2085.     /*----------------------------------------------------------------*/
  2086.     tp_cali_done_struct *rsp;
  2087.     /*----------------------------------------------------------------*/
  2088.     /* Code Body                                                      */
  2089.     /*----------------------------------------------------------------*/
  2090.     rsp = (tp_cali_done_struct*) msg;
  2091.     if (GetExitScrnID() != SCR_CALIBRATION_SETTING)
  2092.     {
  2093.         /* Race condition that screen is changed. */
  2094.         return;
  2095.     }
  2096.     if (rsp->result)
  2097.     {
  2098.         mmi_pen_calibration_struct calibration_data;
  2099.         g_phnset_calibration_cntx_p->finished = MMI_TRUE;
  2100.         /* Write calibration data in NVRAM */
  2101.         mmi_pen_read_calibration_data(&calibration_data);
  2102.         if (g_phnset_calibration_cntx_p->save_to_factory_default)
  2103.         {
  2104.             WriteNvramFactoryDefaultCalibrationData(&calibration_data);
  2105.         }
  2106.         else
  2107.         {
  2108.             WriteNvramCalibrationData(&calibration_data);
  2109.         }
  2110.         if (g_phnset_calibration_cntx_p->finish_callback)
  2111.         {
  2112.             DisplayPopupCallBack(
  2113.                 (U8*) GetString(STR_GLOBAL_DONE),
  2114.                 IMG_GLOBAL_ACTIVATED,
  2115.                 MMI_FALSE,
  2116.                 UI_POPUP_NOTIFYDURATION_TIME,
  2117.                 (U8) SUCCESS_TONE,
  2118.                 g_phnset_calibration_cntx_p->finish_callback);
  2119.         }
  2120.         else
  2121.         {
  2122.             DisplayPopup(
  2123.                 (U8*) GetString(STR_GLOBAL_DONE),
  2124.                 IMG_GLOBAL_ACTIVATED,
  2125.                 MMI_FALSE,
  2126.                 UI_POPUP_NOTIFYDURATION_TIME,
  2127.                 (U8) SUCCESS_TONE);
  2128.         }
  2129.     }
  2130.     else
  2131.     {
  2132.         /*
  2133.          * Flush pen event queue because Pen Down event of the 3rd point might come after 
  2134.          * * MSG_ID_TP_CALI_DONE, but it is changed to CALIBRATION_TOP_LEFT_POINT_STATE.
  2135.          */
  2136.         mmi_pen_reset();
  2137.         /* Restart calibration process */
  2138.         CalibrationSettingRestoreData();
  2139.         g_phnset_calibration_screen_state = CALIBRATION_TOP_LEFT_POINT_STATE;
  2140.         UpdateCalibrationScreen(
  2141.             IMG_CALIBRATION_TOP_LEFT,
  2142.             g_phnset_calibration_cntx_p->points[0].x,
  2143.             g_phnset_calibration_cntx_p->points[0].y,
  2144.             STR_CALIBRATION_TOP_LEFT_TEXT,
  2145.             CALIBRATION_TOP_LEFT_POINT_STATE,
  2146.             MMI_TRUE);
  2147.         mmi_pen_start_calibration(NUM_CALIBRATION_POINTS, g_phnset_calibration_cntx_p->points);
  2148.     }
  2149. }
  2150. #endif /* __MTK_TARGET__ */ 
  2151. /*****************************************************************************
  2152.  * FUNCTION
  2153.  *  EntryCalibrationSettingScr
  2154.  * DESCRIPTION
  2155.  *  Entry function for Calibration Setting Screen
  2156.  * PARAMETERS
  2157.  *  void
  2158.  * RETURNS
  2159.  *  void
  2160.  *****************************************************************************/
  2161. void EntryCalibrationSettingScr(void)
  2162. {
  2163.     /*----------------------------------------------------------------*/
  2164.     /* Local Variables                                                */
  2165.     /*----------------------------------------------------------------*/
  2166.     /*----------------------------------------------------------------*/
  2167.     /* Code Body                                                      */
  2168.     /*----------------------------------------------------------------*/
  2169. #ifdef __MTK_TARGET__
  2170.     SetProtocolEventHandler(PhnsetCalibrationDriverRsp, MSG_ID_TP_CALI_DONE);
  2171. #endif 
  2172.     EntryNewScreen(SCR_CALIBRATION_SETTING, ExitCalibrationSettingScr, NULL, NULL);
  2173.     g_phnset_calibration_cntx_p = OslMalloc(sizeof(mmi_phnset_calibration_struct));
  2174.     g_phnset_calibration_cntx_p->finished = MMI_FALSE;
  2175.     g_phnset_calibration_cntx_p->save_to_factory_default = MMI_FALSE;
  2176. #ifdef __MMI_TOUCH_SCREEN__
  2177.     g_phnset_calibration_cntx_p->finish_callback = NULL;
  2178.     /* 1st & 2nd point should not on the margin */
  2179.     g_phnset_calibration_cntx_p->points[0].x = UI_device_width / 10;
  2180.     g_phnset_calibration_cntx_p->points[0].y = UI_device_height / 10;
  2181.     g_phnset_calibration_cntx_p->points[1].x = UI_device_width * 9 / 10;
  2182.     g_phnset_calibration_cntx_p->points[1].y = UI_device_height * 9 / 10;
  2183.     /*
  2184.      * 3rd point should be different from the ceter point 
  2185.      * * such that driver can check it's ADC value
  2186.      */
  2187.     g_phnset_calibration_cntx_p->points[2].x = UI_device_width * 11 / 20;
  2188.     g_phnset_calibration_cntx_p->points[2].y = UI_device_height * 11 / 20;
  2189. #else /* __MMI_TOUCH_SCREEN__ */ 
  2190.     g_phnset_calibration_cntx_p->finish_callback = EntryTestControlAreaScr;
  2191.     /* 1st & 2nd point should not on the margin */
  2192.     g_phnset_calibration_cntx_p->points[0] = tp_calibration_point[0];
  2193.     g_phnset_calibration_cntx_p->points[1] = tp_calibration_point[1];
  2194.     g_phnset_calibration_cntx_p->points[2] = tp_calibration_point[2];
  2195. #endif /* __MMI_TOUCH_SCREEN__ */ 
  2196.     /* 1.Back up user calibration data */
  2197.     mmi_pen_read_calibration_data(&g_phnset_calibration_cntx_p->backup_data);
  2198.     /* 2 Show Calibration Welcome screen */
  2199.     g_phnset_calibration_screen_state = CALIBRATION_WELCOME_STATE;
  2200.     ShowCalibrationScreen(0, 0, 0, STR_CALIBRATION_WELCOME_TEXT, CALIBRATION_WELCOME_STATE);
  2201.     TurnOnBacklight(0);
  2202.     /* 3. Register Pen Handlers 
  2203.        Because hardware can not get correct ADC value on PenUp, we use PenDown for calibration. */
  2204.     ClearInputEventHandler(MMI_DEVICE_ALL);
  2205.     mmi_pen_register_up_handler(mmi_pen_dummy_hdlr);
  2206.     mmi_pen_register_down_handler(CalibrationSettingPenDown);
  2207.     mmi_pen_register_move_handler(mmi_pen_dummy_hdlr);
  2208.     mmi_pen_register_abort_handler(mmi_pen_dummy_hdlr);
  2209.     mmi_pen_register_repeat_handler(mmi_pen_dummy_hdlr);
  2210.     mmi_pen_register_long_tap_handler(mmi_pen_dummy_hdlr);
  2211. }
  2212. /*****************************************************************************
  2213.  * FUNCTION
  2214.  *  EntryPhnseFactoryDefaultCalibrationScr_internal
  2215.  * DESCRIPTION
  2216.  *  Entry function for Calibration Screen of factory default value
  2217.  * PARAMETERS
  2218.  *  void
  2219.  *  callback(?)     [IN]        Callback function after calibration is finished.
  2220.  * RETURNS
  2221.  *  void
  2222.  *****************************************************************************/
  2223. static void (*g_phnset_factory_default_finish_callback) (void);
  2224. static void EntryPhnseFactoryDefaultCalibrationScr_internal(void)
  2225. {
  2226.     /*----------------------------------------------------------------*/
  2227.     /* Local Variables                                                */
  2228.     /*----------------------------------------------------------------*/
  2229.     /*----------------------------------------------------------------*/
  2230.     /* Code Body                                                      */
  2231.     /*----------------------------------------------------------------*/
  2232.     EntryCalibrationSettingScr();
  2233.     ClearKeyHandler(KEY_END, KEY_EVENT_DOWN);
  2234.     g_phnset_calibration_cntx_p->save_to_factory_default = MMI_TRUE;
  2235.     g_phnset_calibration_cntx_p->finish_callback = g_phnset_factory_default_finish_callback;
  2236. }
  2237. /*****************************************************************************
  2238.  * FUNCTION
  2239.  *  EntryPhnseFactoryDefaultCalibrationScr
  2240.  * DESCRIPTION
  2241.  *  
  2242.  * PARAMETERS
  2243.  *  callback        [IN]        
  2244.  * RETURNS
  2245.  *  void
  2246.  *****************************************************************************/
  2247. void EntryPhnseFactoryDefaultCalibrationScr(void (*callback) (void))
  2248. {
  2249.     /*----------------------------------------------------------------*/
  2250.     /* Local Variables                                                */
  2251.     /*----------------------------------------------------------------*/
  2252.     /*----------------------------------------------------------------*/
  2253.     /* Code Body                                                      */
  2254.     /*----------------------------------------------------------------*/
  2255.     g_phnset_factory_default_finish_callback = callback;
  2256.     EntryPhnseFactoryDefaultCalibrationScr_internal();
  2257. }
  2258. /*****************************************************************************
  2259.  * FUNCTION
  2260.  *  ExitCalibrationSettingScr
  2261.  * DESCRIPTION
  2262.  *  Exit function for Calibration Setting Screen
  2263.  * PARAMETERS
  2264.  *  void
  2265.  * RETURNS
  2266.  *  void
  2267.  *****************************************************************************/
  2268. void ExitCalibrationSettingScr(void)
  2269. {
  2270.     /*----------------------------------------------------------------*/
  2271.     /* Local Variables                                                */
  2272.     /*----------------------------------------------------------------*/
  2273.     history h;
  2274.     U16 nHistory = 0;
  2275.     /*----------------------------------------------------------------*/
  2276.     /* Code Body                                                      */
  2277.     /*----------------------------------------------------------------*/
  2278.     if (!g_phnset_calibration_cntx_p->finished)
  2279.     {
  2280.         /* Restore calibration previously set */
  2281.         mmi_pen_set_calibration_data(&g_phnset_calibration_cntx_p->backup_data);
  2282.         /* Calibration screen should be put in history, e.g. "Invalid SIM" popup on boot */
  2283.         h.scrnID = SCR_CALIBRATION_SETTING;
  2284.         if (g_phnset_calibration_cntx_p->save_to_factory_default)
  2285.         {
  2286.             h.entryFuncPtr = EntryPhnseFactoryDefaultCalibrationScr_internal;
  2287.         }
  2288.         else
  2289.         {
  2290.             h.entryFuncPtr = EntryCalibrationSettingScr;
  2291.         }
  2292.         pfnUnicodeStrcpy((S8*) h.inputBuffer, (S8*) & nHistory);
  2293.         memset(h.guiBuffer, 0, sizeof(h.guiBuffer));
  2294.         AddHistory(h);
  2295.     }
  2296.     g_phnset_calibration_screen_state = CALIBRATION_NULL_STATE;
  2297.     OslMfree(g_phnset_calibration_cntx_p);
  2298.     g_phnset_calibration_cntx_p = NULL;
  2299.     TurnOffBacklight();
  2300. }
  2301. /*****************************************************************************
  2302.  * FUNCTION
  2303.  *  PhnsetNeedFactoryDefaultCalibration
  2304.  * DESCRIPTION
  2305.  *  Whether pen is calibrated.
  2306.  * PARAMETERS
  2307.  *  void
  2308.  * RETURNS
  2309.  * BOOL
  2310.  *****************************************************************************/
  2311. BOOL PhnsetNeedFactoryDefaultCalibration(void)
  2312. {
  2313. #ifdef MMI_ON_WIN32
  2314.     /*----------------------------------------------------------------*/
  2315.     /* Local Variables                                                */
  2316.     /*----------------------------------------------------------------*/
  2317.     /*----------------------------------------------------------------*/
  2318.     /* Code Body                                                      */
  2319.     /*----------------------------------------------------------------*/
  2320.     /* PC Simulator does not support NVRAM */
  2321.     return MMI_FALSE;
  2322. #else /* MMI_ON_WIN32 */ 
  2323.     if (!g_phnset_cntx_p->is_default_calibration_set)
  2324.     {
  2325.         return MMI_TRUE;
  2326.     }
  2327.     else
  2328.     {
  2329.         return MMI_FALSE;
  2330.     }
  2331. #endif /* MMI_ON_WIN32 */ 
  2332. }
  2333. #ifdef __MMI_HANDWRITING_PAD__
  2334. /*****************************************************************************
  2335.  * FUNCTION
  2336.  *  TestControlAreaPenDown
  2337.  * DESCRIPTION
  2338.  *  PenDown Handler for Test Control Area Screen
  2339.  * PARAMETERS
  2340.  *  point       [IN]        
  2341.  * RETURNS
  2342.  *  void
  2343.  *****************************************************************************/
  2344. static void TestControlAreaPenDown(mmi_pen_point_struct point)
  2345. {
  2346.     /*----------------------------------------------------------------*/
  2347.     /* Local Variables                                                */
  2348.     /*----------------------------------------------------------------*/
  2349.     U16 state;
  2350.     /*----------------------------------------------------------------*/
  2351.     /* Code Body                                                      */
  2352.     /*----------------------------------------------------------------*/
  2353.     state = UpdateTestControlAreaScreen(
  2354.                 point,
  2355.                 STR_TEST_CONTROL_AREA_WELCOME_TEXT,
  2356.                 TEST_CONTROL_AREA_TESTING_STATE,
  2357.                 MMI_TRUE);
  2358.     Trace2(TRACE_GROUP_2, "[G] TestControlAreaPenDown - state:%d   (%d, %d) ", state, point.x, point.y);
  2359.     if (state == TEST_CONTROL_AREA_FINISH_STATE)
  2360.     {
  2361.         mmi_frm_setup_default_pen_handler();
  2362.         DisplayPopup(
  2363.             (U8*) GetString(STR_GLOBAL_DONE),
  2364.             IMG_GLOBAL_ACTIVATED,
  2365.             MMI_FALSE,
  2366.             UI_POPUP_NOTIFYDURATION_TIME,
  2367.             (U8) SUCCESS_TONE);
  2368.     }
  2369. }
  2370. /*****************************************************************************
  2371.  * FUNCTION
  2372.  *  ExitControlAreaTestingScr
  2373.  * DESCRIPTION
  2374.  *  Exit function for Calibration Setting Screen
  2375.  * PARAMETERS
  2376.  *  void
  2377.  * RETURNS
  2378.  *  void
  2379.  *****************************************************************************/
  2380. void ExitControlAreaTestingScr(void)
  2381. {
  2382.     /*----------------------------------------------------------------*/
  2383.     /* Local Variables                                                */
  2384.     /*----------------------------------------------------------------*/
  2385.     /*----------------------------------------------------------------*/
  2386.     /* Code Body                                                      */
  2387.     /*----------------------------------------------------------------*/
  2388.     TurnOffBacklight();
  2389. }
  2390. /*****************************************************************************
  2391.  * FUNCTION
  2392.  *  EntryTestControlAreaScr
  2393.  * DESCRIPTION
  2394.  *  Entry function for Test Control Area Screen
  2395.  * PARAMETERS
  2396.  *  void
  2397.  * RETURNS
  2398.  *  void
  2399.  *****************************************************************************/
  2400. void EntryTestControlAreaScr(void)
  2401. {
  2402.     /*----------------------------------------------------------------*/
  2403.     /* Local Variables                                                */
  2404.     /*----------------------------------------------------------------*/
  2405.     mmi_pen_point_struct pos = {0};
  2406.     /*----------------------------------------------------------------*/
  2407.     /* Code Body                                                      */
  2408.     /*----------------------------------------------------------------*/
  2409.     EntryNewScreen(SCR_CALIBRATION_CONTROL_AREA_TESTING, ExitControlAreaTestingScr, NULL, NULL);
  2410.     /* Show control area test screen */
  2411.     ShowTestControlAreaScreen(pos, STR_TEST_CONTROL_AREA_WELCOME_TEXT, TEST_CONTROL_AREA_WELCOME_STATE);
  2412.     TurnOnBacklight(0);
  2413.     /* 2. Register Pen Handlers 
  2414.        Because hardware can not get correct ADC value on PenUp, we use PenDown for calibration. */
  2415.     ClearInputEventHandler(MMI_DEVICE_ALL);
  2416.     mmi_pen_register_up_handler(mmi_pen_dummy_hdlr);
  2417.     mmi_pen_register_down_handler(TestControlAreaPenDown);
  2418.     mmi_pen_register_move_handler(mmi_pen_dummy_hdlr);
  2419.     mmi_pen_register_abort_handler(mmi_pen_dummy_hdlr);
  2420.     mmi_pen_register_repeat_handler(mmi_pen_dummy_hdlr);
  2421.     mmi_pen_register_long_tap_handler(mmi_pen_dummy_hdlr);
  2422. }
  2423. #endif /* __MMI_HANDWRITING_PAD__ */ 
  2424. /*****************************************************************************
  2425.  * FUNCTION
  2426.  *  PhnsetGetHandwritingColor
  2427.  * DESCRIPTION
  2428.  *  Get handwriting stroke color
  2429.  * PARAMETERS
  2430.  *  void
  2431.  * RETURNS
  2432.  *  color
  2433.  *****************************************************************************/
  2434. color PhnsetGetHandwritingColor(void)
  2435. {
  2436.     /*----------------------------------------------------------------*/
  2437.     /* Local Variables                                                */
  2438.     /*----------------------------------------------------------------*/
  2439.     /*----------------------------------------------------------------*/
  2440.     /* Code Body                                                      */
  2441.     /*----------------------------------------------------------------*/
  2442.     MMI_ASSERT(g_phnset_cntx_p->pen_color < MAX_PEN_COLORS);
  2443.     return g_pen_color_list[g_phnset_cntx_p->pen_color];
  2444. }
  2445. /*****************************************************************************
  2446.  * FUNCTION
  2447.  *  PhnsetGetHandwritingSpeed
  2448.  * DESCRIPTION
  2449.  *  Get handwriting speed
  2450.  * PARAMETERS
  2451.  *  void
  2452.  * RETURNS
  2453.  *  PHNSET_HANDWRITING_SPEED_ENUM
  2454.  *****************************************************************************/
  2455. PHNSET_HANDWRITING_SPEED_ENUM PhnsetGetHandwritingSpeed(void)
  2456. {
  2457.     /*----------------------------------------------------------------*/
  2458.     /* Local Variables                                                */
  2459.     /*----------------------------------------------------------------*/
  2460.     /*----------------------------------------------------------------*/
  2461.     /* Code Body                                                      */
  2462.     /*----------------------------------------------------------------*/
  2463.     switch (g_phnset_cntx_p->pen_speed)
  2464.     {
  2465.         case 0:
  2466.             return PHNSET_HANDWRITING_FAST;
  2467.         case 1:
  2468.             return PHNSET_HANDWRITING_MEDIUM;
  2469.         case 2:
  2470.             return PHNSET_HANDWRITING_SLOW;
  2471.         default:
  2472.             MMI_ASSERT(0);
  2473.             return PHNSET_HANDWRITING_MEDIUM;
  2474.     }
  2475. }
  2476. #endif /* defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__) */ 
  2477. /*****************************************************************************
  2478.  * FUNCTION