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

MTK

开发平台:

C/C++

  1. /*****************************************************************************
  2. *  Copyright Statement:
  3. *  --------------------
  4. *  This software is protected by Copyright and the information contained
  5. *  herein is confidential. The software may not be copied and the information
  6. *  contained herein may not be used or disclosed except with the written
  7. *  permission of MediaTek Inc. (C) 2005
  8. *
  9. *  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
  10. *  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
  11. *  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
  12. *  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
  13. *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
  14. *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
  15. *  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
  16. *  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
  17. *  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
  18. *  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
  19. *  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
  20. *  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
  21. *
  22. *  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
  23. *  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
  24. *  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
  25. *  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
  26. *  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. 
  27. *
  28. *  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
  29. *  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
  30. *  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
  31. *  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
  32. *  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
  33. *
  34. *****************************************************************************/
  35. /*****************************************************************************
  36.  *
  37.  * Filename:
  38.  * ---------
  39.  * SubLCDHistory.c
  40.  *
  41.  * Project:
  42.  * --------
  43.  *   MAUI
  44.  *
  45.  * Description:
  46.  * ------------
  47.  *   This file is intends for sublcd history control
  48.  *
  49.  * Author:
  50.  * -------
  51.  * -------
  52.  *
  53.  *============================================================================
  54.  *             HISTORY
  55.  * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  56.  *------------------------------------------------------------------------------
  57.  * removed!
  58.  *
  59.  * removed!
  60.  * removed!
  61.  * removed!
  62.  *
  63.  * removed!
  64.  * removed!
  65.  * removed!
  66.  *
  67.  * removed!
  68.  * removed!
  69.  * removed!
  70.  *
  71.  * removed!
  72.  * removed!
  73.  * removed!
  74.  *
  75.  * removed!
  76.  * removed!
  77.  * removed!
  78.  *
  79.  * removed!
  80.  * removed!
  81.  * removed!
  82.  *
  83.  * removed!
  84.  * removed!
  85.  * removed!
  86.  *
  87.  * removed!
  88.  * removed!
  89.  * removed!
  90.  *
  91.  * removed!
  92.  * removed!
  93.  * removed!
  94.  *
  95.  * removed!
  96.  * removed!
  97.  * removed!
  98.  *
  99.  * removed!
  100.  * removed!
  101.  * removed!
  102.  *
  103.  * removed!
  104.  * removed!
  105.  * removed!
  106.  *
  107.  * removed!
  108.  * removed!
  109.  * removed!
  110.  *
  111.  * removed!
  112.  * removed!
  113.  * removed!
  114.  *
  115.  * removed!
  116.  * removed!
  117.  * removed!
  118.  * removed!
  119.  * removed!
  120.  * removed!
  121.  * removed!
  122.  * removed!
  123.  * removed!
  124.  * removed!
  125.  * removed!
  126.  * removed!
  127.  * removed!
  128.  * removed!
  129.  * removed!
  130.  * removed!
  131.  * removed!
  132.  * removed!
  133.  * removed!
  134.  * removed!
  135.  * removed!
  136.  *
  137.  * removed!
  138.  * removed!
  139.  * removed!
  140.  *
  141.  * removed!
  142.  * removed!
  143.  * removed!
  144.  *
  145.  * removed!
  146.  * removed!
  147.  * removed!
  148.  *
  149.  * removed!
  150.  * removed!
  151.  * removed!
  152.  *
  153.  * removed!
  154.  * removed!
  155.  * removed!
  156.  *
  157.  * removed!
  158.  * removed!
  159.  * removed!
  160.  *
  161.  * removed!
  162.  * removed!
  163.  * removed!
  164.  *
  165.  * removed!
  166.  * removed!
  167.  * removed!
  168.  *
  169.  * removed!
  170.  * removed!
  171.  * removed!
  172.  *
  173.  * removed!
  174.  * removed!
  175.  * removed!
  176.  *
  177.  * removed!
  178.  * removed!
  179.  * removed!
  180.  *
  181.  *------------------------------------------------------------------------------
  182.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  183.  *============================================================================
  184.  ****************************************************************************/
  185. /**
  186.  * Copyright Notice
  187.  * ?2002 - 2003, Pixtel Communications, Inc., 1489 43rd Ave. W.,
  188.  * Vancouver, B.C. V6M 4K8 Canada. All Rights Reserved.
  189.  *  (It is illegal to remove this copyright notice from this software or any
  190.  *  portion of it)
  191.  */
  192. /**************************************************************
  193.    FILENAME : SubLCDHistory.c
  194.    PURPOSE     : Implementation of Sub-LCD history stack
  195.    REMARKS     : nil
  196.    AUTHOR      : Deepali
  197.    DATE     : Sept 23, 2003
  198. **************************************************************/
  199. #include "MMI_features.h"
  200. #include "stdC.h"
  201. #include "L4Dr1.h"
  202. #include "PixtelDataTypes.h"
  203. #include "DebugInitDef.h"
  204. #include "FrameworkStruct.h"
  205. #include "HistoryGprot.h"
  206. #include "HistoryDcl.h"
  207. #include "SubLCDHistoryDef.h"
  208. #include "SubLCDHistoryGprot.h"
  209. #include "Unicodexdcl.h"
  210. #include "l4dr.h"
  211. #include "MMI_trc.h"
  212. #define SUB_LCD_DUMMY_SCRNID     (0x9999)
  213. /* 
  214.  *   Extern Varibales 
  215.  */
  216. /* 
  217.  *   Local Variables 
  218.  */
  219. #ifdef __MMI_SUBLCD__
  220. static SubLCDHistoryInternalNode SubLCDHistoryData[MAX_SUBLCD_HISTORY]; /* array of history data */
  221. static pBOOL IsBackSubLCDHistory = FALSE;
  222. static signed char NodeIndex = -1;
  223. static U16 gCurrTopSubLCDScrnID = 0;
  224. static U16 gCurrExitSubLCDScrnID = 0;
  225. static FuncPtr gCurrExitSubLCDFn = NULL;
  226. static FuncPtr gCurrEntrySubLCDFn = NULL;
  227. static SubLcdHistoryCBPtr ExecuteRootSubLcdHistoryScreenPtr = NULL;
  228. #ifdef __MMI_UI_TAB_PANE__
  229. S32 disable_subLCD_history_save = 0;
  230. #endif 
  231. #endif /* __MMI_SUBLCD__ */ 
  232. /*****************************************************************************
  233.  * FUNCTION
  234.  *  ExecSubLCDCurrExitHandler
  235.  * DESCRIPTION
  236.  *  Execute the Current Exit handler of SubLCD
  237.  * PARAMETERS
  238.  *  void
  239.  * RETURNS
  240.  *  void
  241.  *****************************************************************************/
  242. void ExecSubLCDCurrExitHandler(void)
  243. {
  244. #ifdef __MMI_SUBLCD__
  245.     /*----------------------------------------------------------------*/
  246.     /* Local Variables                                                */
  247.     /*----------------------------------------------------------------*/
  248.     /*----------------------------------------------------------------*/
  249.     /* Code Body                                                      */
  250.     /*----------------------------------------------------------------*/
  251.     MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_SUBHIST_EXE_SUBLCD_CUR_EXIT_HDLR));
  252.     /*
  253.      * When goback history in subLCD, we should execute current exit handler but
  254.      * not allow to add the history.
  255.      */
  256.     if (gCurrExitSubLCDFn != NULL)
  257.     {
  258.         gCurrExitSubLCDFn();
  259.         gCurrExitSubLCDFn = NULL;
  260.     }
  261.     IsBackSubLCDHistory = FALSE;
  262. #endif /* __MMI_SUBLCD__ */ 
  263. }
  264. /*****************************************************************************
  265.  * FUNCTION
  266.  *  AddSubLCDHistory
  267.  * DESCRIPTION
  268.  *  Saves Sublcd function in History
  269.  * PARAMETERS
  270.  *  CurrSubLCDHistory       [IN]        
  271.  * RETURNS
  272.  *  void
  273.  *****************************************************************************/
  274. void AddSubLCDHistory(SubLCDHistoryNode *CurrSubLCDHistory)
  275. {
  276. #ifdef __MMI_SUBLCD__
  277.     /*----------------------------------------------------------------*/
  278.     /* Local Variables                                                */
  279.     /*----------------------------------------------------------------*/
  280.     /*----------------------------------------------------------------*/
  281.     /* Code Body                                                      */
  282.     /*----------------------------------------------------------------*/
  283. #ifdef __MMI_UI_TAB_PANE__
  284.     if (disable_subLCD_history_save)
  285.     {
  286.         return;
  287.     }
  288. #endif /* __MMI_UI_TAB_PANE__ */ 
  289. #ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
  290.     if (redraw_in_small_screen_proceduer())
  291.     {
  292.         return;
  293.     }
  294. #endif /* __MMI_UI_SMALL_SCREEN_SUPPORT__ */ 
  295.     MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_SUBHIST_ADD_SUBLCD_HIST_HDLR));
  296.     /* MTK added by JL for back history. */
  297.     if (IsBackSubLCDHistory != TRUE)
  298.     {
  299.         FuncPtr CurrSubLCDEntryFn = CurrSubLCDHistory->entryFuncPtr;
  300.         if (CurrSubLCDEntryFn != NULL)
  301.         {
  302.             SubLCDHistoryData[++NodeIndex].entryFuncPtr = CurrSubLCDEntryFn;
  303.             SubLCDHistoryData[NodeIndex].scrnID = SUB_LCD_DUMMY_SCRNID;
  304.             SubLCDHistoryData[NodeIndex].guiLen = 0;
  305.             SubLCDHistoryData[NodeIndex].guiBuffer = NULL;
  306.         }
  307.     }
  308.     IsBackSubLCDHistory = FALSE;
  309. #endif /* __MMI_SUBLCD__ */ 
  310. }
  311. /*****************************************************************************
  312.  * FUNCTION
  313.  *  AddSubLCDHistoryWithScrID
  314.  * DESCRIPTION
  315.  *  Saves Sublcd function in History with ScrID
  316.  * PARAMETERS
  317.  *  CurrSubLCDHistory       [IN]        
  318.  *  scrID                   [IN]        
  319.  * RETURNS
  320.  *  void
  321.  *****************************************************************************/
  322. void AddSubLCDHistoryWithScrID(SubLCDHistoryNode *CurrSubLCDHistory, U16 scrID)
  323. {
  324. #ifdef __MMI_SUBLCD__
  325.     /*----------------------------------------------------------------*/
  326.     /* Local Variables                                                */
  327.     /*----------------------------------------------------------------*/
  328.     SubLCDHistoryNodeEx subLCDHistory = {0};
  329.     /*----------------------------------------------------------------*/
  330.     /* Code Body                                                      */
  331.     /*----------------------------------------------------------------*/
  332. #ifdef __MMI_UI_TAB_PANE__
  333.     if (disable_subLCD_history_save)
  334.     {
  335.         return;
  336.     }
  337. #endif /* __MMI_UI_TAB_PANE__ */ 
  338. #ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
  339.     if (redraw_in_small_screen_proceduer())
  340.     {
  341.         return;
  342.     }
  343. #endif /* __MMI_UI_SMALL_SCREEN_SUPPORT__ */ 
  344.     subLCDHistory.entryFuncPtr = CurrSubLCDHistory->entryFuncPtr;
  345.     subLCDHistory.scrnID = scrID;
  346.     AddSubLCDHistoryWithScrIDEx(&subLCDHistory, scrID);
  347. #endif /* __MMI_SUBLCD__ */ 
  348. }
  349. /*****************************************************************************
  350.  * FUNCTION
  351.  *  AddSubLCDHistoryWithScrIDEx
  352.  * DESCRIPTION
  353.  *  
  354.  * PARAMETERS
  355.  *  CurrSubLCDHistory       [?]         
  356.  *  scrID                   [IN]        
  357.  * RETURNS
  358.  *  void
  359.  *****************************************************************************/
  360. void AddSubLCDHistoryWithScrIDEx(SubLCDHistoryNodeEx *CurrSubLCDHistory, U16 scrID)
  361. {
  362. #ifdef __MMI_SUBLCD__
  363.     /*----------------------------------------------------------------*/
  364.     /* Local Variables                                                */
  365.     /*----------------------------------------------------------------*/
  366.     /*----------------------------------------------------------------*/
  367.     /* Code Body                                                      */
  368.     /*----------------------------------------------------------------*/
  369. #ifdef __MMI_UI_TAB_PANE__
  370.     if (disable_subLCD_history_save)
  371.     {
  372.         return;
  373.     }
  374. #endif /* __MMI_UI_TAB_PANE__ */ 
  375. #ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
  376.     if (redraw_in_small_screen_proceduer())
  377.     {
  378.         return;
  379.     }
  380. #endif /* __MMI_UI_SMALL_SCREEN_SUPPORT__ */ 
  381.     MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_SUBHIST_ADD_SUBLCD_HIST_WITHSCRID_HDLR, scrID));
  382.     /* MTK added by JL for back history. */
  383.     if (IsBackSubLCDHistory != TRUE)
  384.     {
  385.         FuncPtr CurrSubLCDEntryFn = CurrSubLCDHistory->entryFuncPtr;
  386.         if (CurrSubLCDEntryFn != NULL)
  387.         {
  388.             SubLCDHistoryData[++NodeIndex].entryFuncPtr = CurrSubLCDEntryFn;
  389.             SubLCDHistoryData[NodeIndex].scrnID = scrID;
  390.             SubLCDHistoryData[NodeIndex].guiLen = 0;
  391.             SubLCDHistoryData[NodeIndex].guiBuffer = NULL;
  392.             if (pfnUnicodeStrlen((PS8) (CurrSubLCDHistory->guiBuffer)))
  393.             {
  394.                 SubLCDHistoryData[NodeIndex].guiLen = MAX_GUI_BUFFER;
  395.                 SubLCDHistoryData[NodeIndex].guiBuffer = OslMalloc(MAX_GUI_BUFFER);
  396.                 memcpy(SubLCDHistoryData[NodeIndex].guiBuffer, CurrSubLCDHistory->guiBuffer, MAX_GUI_BUFFER);
  397.             }
  398.         }
  399.     }
  400.     IsBackSubLCDHistory = FALSE;
  401. #endif /* __MMI_SUBLCD__ */ 
  402. }
  403. /*****************************************************************************
  404.  * FUNCTION
  405.  *  SetSubLCDExitHandler
  406.  * DESCRIPTION
  407.  *  Set Exit handler for Current screen
  408.  * PARAMETERS
  409.  *  CurrSubLCDFn        [IN]        
  410.  * RETURNS
  411.  *  void
  412.  *****************************************************************************/
  413. void SetSubLCDExitHandler(FuncPtr CurrSubLCDFn)
  414. {
  415. #ifdef __MMI_SUBLCD__
  416.     /*----------------------------------------------------------------*/
  417.     /* Local Variables                                                */
  418.     /*----------------------------------------------------------------*/
  419.     /*----------------------------------------------------------------*/
  420.     /* Code Body                                                      */
  421.     /*----------------------------------------------------------------*/
  422.     MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_SUBHIST_ADD_SUBLCD_EXIT_HDLR, CurrSubLCDFn));
  423.     gCurrExitSubLCDFn = CurrSubLCDFn;
  424. #endif /* __MMI_SUBLCD__ */ 
  425. }
  426. /*****************************************************************************
  427.  * FUNCTION
  428.  *  SetSubLCDEntryHandler
  429.  * DESCRIPTION
  430.  *  Set Entry handler for Current screen
  431.  * PARAMETERS
  432.  *  CurrSubLCDFn                [IN]        
  433.  *  CurrSubLCDEntryFn(?)        [IN]        
  434.  * RETURNS
  435.  *  void
  436.  *****************************************************************************/
  437. void SetSubLCDEntryHandler(FuncPtr CurrSubLCDFn)
  438. {
  439. #ifdef __MMI_SUBLCD__
  440.     /*----------------------------------------------------------------*/
  441.     /* Local Variables                                                */
  442.     /*----------------------------------------------------------------*/
  443.     /*----------------------------------------------------------------*/
  444.     /* Code Body                                                      */
  445.     /*----------------------------------------------------------------*/
  446.     MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_SUBHIST_ADD_SUBLCD_ENTRY_HDLR, CurrSubLCDFn));
  447.     gCurrEntrySubLCDFn = CurrSubLCDFn;
  448. #endif /* __MMI_SUBLCD__ */ 
  449. }
  450. /*****************************************************************************
  451.  * FUNCTION
  452.  *  DecrementSubLCD
  453.  * DESCRIPTION
  454.  *  decrement the global history index of sub-LCD
  455.  *  
  456.  *  decrement the global NodeIndex
  457.  * PARAMETERS
  458.  *  void
  459.  * RETURNS
  460.  *  void
  461.  *****************************************************************************/
  462. static void DecrementSubLCD(void)
  463. {
  464. #ifdef __MMI_SUBLCD__
  465.     /*----------------------------------------------------------------*/
  466.     /* Local Variables                                                */
  467.     /*----------------------------------------------------------------*/
  468.     /*----------------------------------------------------------------*/
  469.     /* Code Body                                                      */
  470.     /*----------------------------------------------------------------*/
  471.     if (NodeIndex >= 0)
  472.     {
  473.         if (SubLCDHistoryData[NodeIndex].guiBuffer)
  474.         {
  475.             OslMfree(SubLCDHistoryData[NodeIndex].guiBuffer);
  476.         }
  477.         memset(&SubLCDHistoryData[NodeIndex], 0, sizeof(SubLCDHistoryNode));
  478.         NodeIndex--;
  479.     }
  480. #endif /* __MMI_SUBLCD__ */ 
  481. }
  482. /*****************************************************************************
  483.  * FUNCTION
  484.  *  InitSubLCDHistory
  485.  * DESCRIPTION
  486.  *  De-intialize SubLCD Screen history
  487.  * PARAMETERS
  488.  *  sublcd_root_screen_cb_ptr       [IN]        
  489.  * RETURNS
  490.  *  void
  491.  *****************************************************************************/
  492. void InitSubLCDHistory(SubLcdHistoryCBPtr sublcd_root_screen_cb_ptr)
  493. {
  494. #ifdef __MMI_SUBLCD__
  495.     /*----------------------------------------------------------------*/
  496.     /* Local Variables                                                */
  497.     /*----------------------------------------------------------------*/
  498.     /*----------------------------------------------------------------*/
  499.     /* Code Body                                                      */
  500.     /*----------------------------------------------------------------*/
  501. #ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
  502.     if (redraw_in_small_screen_proceduer())
  503.     {
  504.         return;
  505.     }
  506. #endif /* __MMI_UI_SMALL_SCREEN_SUPPORT__ */ 
  507.     MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_SUBHIST_INIT, sublcd_root_screen_cb_ptr));
  508.     ExecuteRootSubLcdHistoryScreenPtr = sublcd_root_screen_cb_ptr;
  509. #endif /* __MMI_SUBLCD__ */ 
  510. }
  511. /*****************************************************************************
  512.  * FUNCTION
  513.  *  DinitSubLCDHistory
  514.  * DESCRIPTION
  515.  *  De-intialize SubLCD Screen history
  516.  * PARAMETERS
  517.  *  void
  518.  * RETURNS
  519.  *  void
  520.  *****************************************************************************/
  521. void DinitSubLCDHistory(void)
  522. {
  523. #ifdef __MMI_SUBLCD__
  524.     /*----------------------------------------------------------------*/
  525.     /* Local Variables                                                */
  526.     /*----------------------------------------------------------------*/
  527.     signed char count;
  528.     /*----------------------------------------------------------------*/
  529.     /* Code Body                                                      */
  530.     /*----------------------------------------------------------------*/
  531. #ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
  532.     if (redraw_in_small_screen_proceduer())
  533.     {
  534.         return;
  535.     }
  536. #endif /* __MMI_UI_SMALL_SCREEN_SUPPORT__ */ 
  537.     MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_SUBHIST_DEINIT));
  538.     if (NodeIndex > -1)
  539.     {
  540.         for (count = NodeIndex; count >= 0; count--)
  541.         {
  542.             /* don't check the return value of delCBHandler */
  543.             ExecHistoryScrnCallBackHandle_ex(NodeIndex, 0);
  544.             DecrementSubLCD();
  545.         }
  546.         NodeIndex = -1;
  547.     }
  548. #endif /* __MMI_SUBLCD__ */ 
  549. }
  550. /*****************************************************************************
  551.  * FUNCTION
  552.  *  ShowSubLCDScreen
  553.  * DESCRIPTION
  554.  *  Calls entry function of the specified screen on the
  555.  *  sub-LCD screen
  556.  * PARAMETERS
  557.  *  SubLCDEntryFn       [IN]        
  558.  * RETURNS
  559.  *  void
  560.  *****************************************************************************/
  561. void ShowSubLCDScreen(FuncPtr SubLCDEntryFn)
  562. {
  563. #ifdef __MMI_SUBLCD__
  564.     /*----------------------------------------------------------------*/
  565.     /* Local Variables                                                */
  566.     /*----------------------------------------------------------------*/
  567.     /*----------------------------------------------------------------*/
  568.     /* Code Body                                                      */
  569.     /*----------------------------------------------------------------*/
  570.     MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_SUBHIST_SHOW_SUBLCD_HDLR, SubLCDEntryFn));
  571.     DisplaySubLCDScreen(SUB_LCD_DUMMY_SCRNID, SubLCDEntryFn, 0);
  572. #if 0   /* when new sub LCD API are OK, remove the below code */
  573. /* under construction !*/
  574. /* under construction !*/
  575. /* under construction !*/
  576. #ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__//010706 small screen Calvin
  577. /* under construction !*/
  578. /* under construction !*/
  579. /* under construction !*/
  580. /* under construction !*/
  581. #endif
  582. /* under construction !*/
  583. /* under construction !*/
  584. /* under construction !*/
  585. /* under construction !*/
  586. /* under construction !*/
  587. /* under construction !*/
  588. /* under construction !*/
  589. /* under construction !*/
  590. /* under construction !*/
  591. /* under construction !*/
  592. /* under construction !*/
  593. #endif /* 0 */ /* #if 0 */
  594. #endif /* __MMI_SUBLCD__ */ 
  595. }
  596. /*****************************************************************************
  597.  * FUNCTION
  598.  *  ForceSubLCDScreen
  599.  * DESCRIPTION
  600.  *  force to call entry function of a screen SubLCD Screen
  601.  * PARAMETERS
  602.  *  SubLCDEntryFn       [IN]        
  603.  * RETURNS
  604.  *  void
  605.  *****************************************************************************/
  606. void ForceSubLCDScreen(FuncPtr SubLCDEntryFn)
  607. {
  608. #ifdef __MMI_SUBLCD__
  609.     /*----------------------------------------------------------------*/
  610.     /* Local Variables                                                */
  611.     /*----------------------------------------------------------------*/
  612.     /*----------------------------------------------------------------*/
  613.     /* Code Body                                                      */
  614.     /*----------------------------------------------------------------*/
  615.     MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_SUBHIST_FORCE_SUBLCD_HDLR, SubLCDEntryFn));
  616.     DisplaySubLCDScreen(SUB_LCD_DUMMY_SCRNID, SubLCDEntryFn, 1);
  617. #if 0   /* when new sub LCD API are OK, remove the below code */
  618. /* under construction !*/
  619. /* under construction !*/
  620. /* under construction !*/
  621. /* under construction !*/
  622. /* under construction !*/
  623. /* under construction !*/
  624. /* under construction !*/
  625. /* under construction !*/
  626. #if 0//111405 Calvin removed
  627. /* under construction !*/
  628. /* under construction !*/
  629. /* under construction !*/
  630. /* under construction !*/
  631. /* under construction !*/
  632. #endif
  633. /* under construction !*/
  634. /* under construction !*/
  635. /* under construction !*/
  636. /* under construction !*/
  637. /* under construction !*/
  638. /* under construction !*/
  639. #endif /* 0 */ /* #if 0 */
  640. #endif /* __MMI_SUBLCD__ */ 
  641. }
  642. /*****************************************************************************
  643.  * FUNCTION
  644.  *  DisplaySubLCDScreen
  645.  * DESCRIPTION
  646.  *  Display a screen SubLCD Screen
  647.  * PARAMETERS
  648.  *  scrnId              [IN]        
  649.  *  SubLCDEntryFn       [IN]        
  650.  *  is_force            [IN]        
  651.  * RETURNS
  652.  *  void
  653.  *****************************************************************************/
  654. void DisplaySubLCDScreen(U16 scrnId, FuncPtr SubLCDEntryFn, MMI_BOOL is_force)
  655. {
  656. #ifdef __MMI_SUBLCD__
  657.     /*----------------------------------------------------------------*/
  658.     /* Local Variables                                                */
  659.     /*----------------------------------------------------------------*/
  660.     MMI_BOOL flag = MMI_TRUE;
  661.     /*----------------------------------------------------------------*/
  662.     /* Code Body                                                      */
  663.     /*----------------------------------------------------------------*/
  664.     MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_SUBHIST_DISPLAY_SUBLCD_HDLR, SubLCDEntryFn, scrnId, is_force));
  665.     if (!is_force)
  666.     {
  667.         /* refer ShowSubLCDScreen() */
  668.     #ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__  /* 010706 small screen Calvin */
  669.         if (is_redrawing_old_screens())
  670.         {
  671.             return;
  672.         }
  673.     #endif /* __MMI_UI_SMALL_SCREEN_SUPPORT__ */ 
  674.     }
  675.     if (!is_force)
  676.     {
  677.         /* refer ShowSubLCDScreen() */
  678.         if (IsMainLCDHistoryBack())
  679.         {
  680.             /* no need to display the sub LCD screen */
  681.             flag = MMI_FALSE;
  682.         }
  683.     }
  684.     if (flag)
  685.     {
  686.         gCurrTopSubLCDScrnID = scrnId;
  687.         gCurrEntrySubLCDFn = SubLCDEntryFn;
  688.         SubLCDEntryFn();
  689.         gCurrExitSubLCDScrnID = scrnId;
  690.     }
  691. #endif /* __MMI_SUBLCD__ */ 
  692. }
  693. /*****************************************************************************
  694.  * FUNCTION
  695.  *  GoBackSubLCDHistory
  696.  * DESCRIPTION
  697.  *  Go back to history On SubLCD Screen
  698.  * PARAMETERS
  699.  *  void
  700.  * RETURNS
  701.  *  void
  702.  *****************************************************************************/
  703. void GoBackSubLCDHistory(void)
  704. {
  705. #ifdef __MMI_SUBLCD__
  706.     /*----------------------------------------------------------------*/
  707.     /* Local Variables                                                */
  708.     /*----------------------------------------------------------------*/
  709.     U16 scrnId;
  710.     /*----------------------------------------------------------------*/
  711.     /* Code Body                                                      */
  712.     /*----------------------------------------------------------------*/
  713. #ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
  714.     if (redraw_in_small_screen_proceduer())
  715.     {
  716.         return;
  717.     }
  718. #endif /* __MMI_UI_SMALL_SCREEN_SUPPORT__ */ 
  719.     MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_SUBHIST_GO_BACK_SUBLCD_HDLR));
  720.     if (NodeIndex >= 0)
  721.     {
  722.         IsBackSubLCDHistory = TRUE;
  723.         ExecTopScrnCallbackHandler_ex(0);
  724.         scrnId = SubLCDHistoryData[NodeIndex].scrnID;
  725.         if (SubLCDHistoryData[NodeIndex].entryFuncPtr)
  726.         {
  727.             gCurrTopSubLCDScrnID = scrnId;
  728.             gCurrEntrySubLCDFn = SubLCDHistoryData[NodeIndex].entryFuncPtr;
  729.             SubLCDHistoryData[NodeIndex].entryFuncPtr();
  730.             gCurrExitSubLCDScrnID = scrnId;
  731.         }
  732.         if (SubLCDHistoryData[NodeIndex].scrnID == scrnId)
  733.         {
  734.             DecrementSubLCD();
  735.         }
  736.     }
  737.     else
  738.     {
  739.         ExecTopScrnCallbackHandler_ex(0);
  740.         if (ExecuteRootSubLcdHistoryScreenPtr != NULL)
  741.         {
  742.             gCurrTopSubLCDScrnID = SUB_LCD_DUMMY_SCRNID;
  743.             gCurrEntrySubLCDFn = (FuncPtr) ExecuteRootSubLcdHistoryScreenPtr;
  744.             ExecuteRootSubLcdHistoryScreenPtr(NULL);
  745.             gCurrExitSubLCDScrnID = SUB_LCD_DUMMY_SCRNID;
  746.         }
  747.         NodeIndex = -1;
  748.     }
  749. #endif /* __MMI_SUBLCD__ */ 
  750. }
  751. /*****************************************************************************
  752.  * FUNCTION
  753.  *  GoBacknSubLCDHistory
  754.  * DESCRIPTION
  755.  *  Go back 'n' history On SubLCD Screen
  756.  * PARAMETERS
  757.  *  nHistory        [IN]        
  758.  * RETURNS
  759.  *  void
  760.  *****************************************************************************/
  761. void GoBacknSubLCDHistory(U16 nHistory)
  762. {
  763. #ifdef __MMI_SUBLCD__
  764.     /*----------------------------------------------------------------*/
  765.     /* Local Variables                                                */
  766.     /*----------------------------------------------------------------*/
  767.     S16 Count = 0;
  768.     /*----------------------------------------------------------------*/
  769.     /* Code Body                                                      */
  770.     /*----------------------------------------------------------------*/
  771. #ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
  772.     if (redraw_in_small_screen_proceduer())
  773.     {
  774.         return;
  775.     }
  776. #endif /* __MMI_UI_SMALL_SCREEN_SUPPORT__ */ 
  777.     MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_SUBHIST_GO_BACK_N_SUBLCD_HDLR, nHistory));
  778.     if (NodeIndex >= nHistory)
  779.     {
  780.         IsBackSubLCDHistory = TRUE;
  781.         for (Count = nHistory; Count >= 0; --Count)
  782.         {
  783.             /* JL, if want to stop to run next decrement will return true. */
  784.             if (ExecHistoryScrnCallBackHandle_ex(NodeIndex, 0) == MMI_HIST_STOP_DELETING)
  785.             {
  786.                 break;
  787.             }
  788.             DecrementSubLCD();
  789.         }
  790.         GoBackSubLCDHistory();
  791.     }
  792. #endif /* __MMI_SUBLCD__ */ 
  793. }
  794. /*****************************************************************************
  795.  * FUNCTION
  796.  *  GoBackToSubLCDHistory
  797.  * DESCRIPTION
  798.  *  Goes back to specified screen on sub-LCD
  799.  * PARAMETERS
  800.  *  scrnid      [IN]        
  801.  * RETURNS
  802.  *  U8 - status
  803.  *****************************************************************************/
  804. U8 GoBackToSubLCDHistory(U16 scrnid)
  805. {
  806.     /*----------------------------------------------------------------*/
  807.     /* Local Variables                                                */
  808.     /*----------------------------------------------------------------*/
  809.     U8 Status = ST_FAILURE;
  810. #ifdef __MMI_SUBLCD__
  811.     S16 count = 0;
  812.     /*----------------------------------------------------------------*/
  813.     /* Code Body                                                      */
  814.     /*----------------------------------------------------------------*/
  815. #ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
  816.     if (redraw_in_small_screen_proceduer())
  817.     {
  818.         return ST_SUCCESS;
  819.     }
  820. #endif /* __MMI_UI_SMALL_SCREEN_SUPPORT__ */ 
  821.     MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_SUBHIST_GO_BACK_TO_SUBLCD_HDLR, scrnid));
  822.     count = NodeIndex;
  823.     if (!IsSubLCDScreenPresent(scrnid))
  824.     {
  825.         return ST_FAILURE;
  826.     }
  827.     do
  828.     {
  829.         if (NodeIndex >= 0)
  830.         {
  831.             if (SubLCDHistoryData[NodeIndex].scrnID == scrnid)
  832.             {
  833.                 Status = ST_SUCCESS;
  834.                 break;
  835.             }
  836.             if (ExecHistoryScrnCallBackHandle_ex(NodeIndex, 0) == MMI_HIST_STOP_DELETING)
  837.             {
  838.                 Status = ST_SUCCESS;
  839.                 break;
  840.             }
  841.             DecrementSubLCD();
  842.         }
  843.     } while ((count != NodeIndex) && (SubLCDHistoryData[NodeIndex].entryFuncPtr != NULL) && (NodeIndex > 0));
  844.     GoBackSubLCDHistory();
  845. #endif /* __MMI_SUBLCD__ */ 
  846.     return Status;
  847. }
  848. /*****************************************************************************
  849.  * FUNCTION
  850.  *  GoBeyondSubLCDMarkerScr
  851.  * DESCRIPTION
  852.  *  Go one node beyond  marker screen on sub-LCD
  853.  * PARAMETERS
  854.  *  scrnid      [IN]        
  855.  * RETURNS
  856.  *  U8 - status
  857.  *****************************************************************************/
  858. U8 GoBeyondSubLCDMarkerScr(U16 scrnid)
  859. {
  860.     /*----------------------------------------------------------------*/
  861.     /* Local Variables                                                */
  862.     /*----------------------------------------------------------------*/
  863.     U8 Status = ST_FAILURE;
  864. #ifdef __MMI_SUBLCD__
  865.     S16 count = 0;
  866.     /*----------------------------------------------------------------*/
  867.     /* Code Body                                                      */
  868.     /*----------------------------------------------------------------*/
  869. #ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
  870.     if (redraw_in_small_screen_proceduer())
  871.     {
  872.         return ST_SUCCESS;
  873.     }
  874. #endif /* __MMI_UI_SMALL_SCREEN_SUPPORT__ */ 
  875.     MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_SUBHIST_GO_BEYOND_SUBLCD_HDLR, scrnid));
  876.     count = NodeIndex;
  877.     if (!IsSubLCDScreenPresent(scrnid))
  878.     {
  879.         return ST_FAILURE;
  880.     }
  881.     do
  882.     {
  883.         if (NodeIndex > 0)
  884.         {
  885.             if (SubLCDHistoryData[NodeIndex].scrnID == scrnid)
  886.             {
  887.                 Status = ST_SUCCESS;
  888.                 break;
  889.             }
  890.             if (ExecHistoryScrnCallBackHandle_ex(NodeIndex, 0) == MMI_HIST_STOP_DELETING)
  891.             {
  892.                 Status = ST_FAILURE;
  893.                 break;
  894.             }
  895.             DecrementSubLCD();
  896.         }
  897.     } while ((count != NodeIndex) && (SubLCDHistoryData[NodeIndex].entryFuncPtr != NULL));
  898.     MMI_ASSERT(NodeIndex >= 0);
  899.     if (Status)
  900.     {
  901.         /* go one node beyond  marker screen */
  902.         if (ExecHistoryScrnCallBackHandle_ex(NodeIndex, 0) == MMI_HIST_ALLOW_DELETING)
  903.         {
  904.             DecrementSubLCD();
  905.         }
  906.     }
  907.     Status = ST_SUCCESS;
  908.     GoBackSubLCDHistory();
  909. #endif /* __MMI_SUBLCD__ */ 
  910.     return Status;
  911. }
  912. /*****************************************************************************
  913.  * FUNCTION
  914.  *  GoBackBothLCDHistory
  915.  * DESCRIPTION
  916.  *  Go back to history on Main LCD & SubLCD Screen
  917.  * PARAMETERS
  918.  *  void
  919.  * RETURNS
  920.  *  void
  921.  *****************************************************************************/
  922. void GoBackBothLCDHistory(void)
  923. {
  924.     /*----------------------------------------------------------------*/
  925.     /* Local Variables                                                */
  926.     /*----------------------------------------------------------------*/
  927.     /*----------------------------------------------------------------*/
  928.     /* Code Body                                                      */
  929.     /*----------------------------------------------------------------*/
  930. #ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
  931.     if (redraw_in_small_screen_proceduer())
  932.     {
  933.         return;
  934.     }
  935. #endif /* __MMI_UI_SMALL_SCREEN_SUPPORT__ */ 
  936.     MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_SUBHIST_BACK_BOTHLCD_HIST_HDLR));
  937. #ifdef __MMI_SUBLCD__
  938.     GoBackSubLCDHistory();
  939. #endif 
  940.     GoBackHistory();
  941. }
  942. /*****************************************************************************
  943.  * FUNCTION
  944.  *  DeleteUptoSubLCDScrID
  945.  * DESCRIPTION
  946.  *  Go to a screen on sub-LCD and delete history of all ahead of it
  947.  * PARAMETERS
  948.  *  scrnid      [IN]        
  949.  * RETURNS
  950.  *  U8 - status
  951.  *****************************************************************************/
  952. U8 DeleteUptoSubLCDScrID(U16 scrnid)
  953. {
  954.     /*----------------------------------------------------------------*/
  955.     /* Local Variables                                                */
  956.     /*----------------------------------------------------------------*/
  957.     U8 Status = ST_FAILURE;
  958. #ifdef __MMI_SUBLCD__
  959.     S16 count = 0;
  960.     /*----------------------------------------------------------------*/
  961.     /* Code Body                                                      */
  962.     /*----------------------------------------------------------------*/
  963. #ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
  964.     if (redraw_in_small_screen_proceduer())
  965.     {
  966.         return ST_SUCCESS;
  967.     }
  968. #endif /* __MMI_UI_SMALL_SCREEN_SUPPORT__ */ 
  969.     MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_SUBHIST_DEL_UPTO_SUBLCD_SCR_HDLR, scrnid));
  970.     count = NodeIndex;
  971.     if (!IsSubLCDScreenPresent(scrnid))
  972.     {
  973.         return ST_FAILURE;
  974.     }
  975.     do
  976.     {
  977.         if (SubLCDHistoryData[NodeIndex].scrnID == scrnid)
  978.         {
  979.             Status = ST_SUCCESS;
  980.             break;
  981.         }
  982.         if (ExecHistoryScrnCallBackHandle_ex(NodeIndex, 0) == MMI_HIST_STOP_DELETING)
  983.         {
  984.             Status = ST_SUCCESS;
  985.             break;
  986.         }
  987.         DecrementSubLCD();
  988.     } while ((count != NodeIndex) && (SubLCDHistoryData[NodeIndex].entryFuncPtr != NULL));
  989. #endif /* __MMI_SUBLCD__ */ 
  990.     return Status;
  991. }
  992. /*****************************************************************************
  993.  * FUNCTION
  994.  *  DeleteNSubLCDScrId
  995.  * DESCRIPTION
  996.  *  Deletes up to screen id on sub-LCD and go  beyond it one node
  997.  * PARAMETERS
  998.  *  scrnid      [IN]        
  999.  * RETURNS
  1000.  *  U8 - status
  1001.  *****************************************************************************/
  1002. U8 DeleteNSubLCDScrId(U16 scrnid)
  1003. {
  1004.     /*----------------------------------------------------------------*/
  1005.     /* Local Variables                                                */
  1006.     /*----------------------------------------------------------------*/
  1007.     U8 Status = ST_FAILURE;
  1008. #ifdef __MMI_SUBLCD__
  1009.     S16 count = 0;
  1010.     /*----------------------------------------------------------------*/
  1011.     /* Code Body                                                      */
  1012.     /*----------------------------------------------------------------*/
  1013. #ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
  1014.     if (redraw_in_small_screen_proceduer())
  1015.     {
  1016.         return ST_SUCCESS;
  1017.     }
  1018. #endif /* __MMI_UI_SMALL_SCREEN_SUPPORT__ */ 
  1019.     MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_SUBHIST_DEL_N_SUBLCD_SCR_HDLR, scrnid));
  1020.     count = NodeIndex;
  1021.     if (!IsSubLCDScreenPresent(scrnid))
  1022.     {
  1023.         return ST_FAILURE;
  1024.     }
  1025.     do
  1026.     {
  1027.         if (SubLCDHistoryData[NodeIndex].scrnID == scrnid)
  1028.         {
  1029.             Status = ST_SUCCESS;
  1030.             break;
  1031.         }
  1032.         if (ExecHistoryScrnCallBackHandle_ex(NodeIndex, 0) == MMI_HIST_STOP_DELETING)
  1033.         {
  1034.             Status = ST_FAILURE;
  1035.             break;
  1036.         }
  1037.         DecrementSubLCD();
  1038.     } while ((count != NodeIndex) && (SubLCDHistoryData[NodeIndex].entryFuncPtr != NULL));
  1039.     if (Status)
  1040.     {
  1041.         /* delete the one more scrnid of SubLCD history */
  1042.         if (ExecHistoryScrnCallBackHandle_ex(NodeIndex, 0) == MMI_HIST_ALLOW_DELETING)
  1043.         {
  1044.             DecrementSubLCD();
  1045.         }
  1046.     }
  1047. #endif /* __MMI_SUBLCD__ */ 
  1048.     return Status;
  1049. }
  1050. /*****************************************************************************
  1051.  * FUNCTION
  1052.  *  DeleteSubLCDScreen
  1053.  * DESCRIPTION
  1054.  *  Deletes Screen from sub-LCD history
  1055.  *  This screen id won't be deleted
  1056.  * PARAMETERS
  1057.  *  ScrId       [IN]        
  1058.  * RETURNS
  1059.  *  U16 - status
  1060.  * REMARK
  1061.  *  The behavior is the same with DeleteScreenIfPresent()
  1062.  *****************************************************************************/
  1063. U16 DeleteSubLCDScreen(U16 ScrId)
  1064. {
  1065.     U8 Status = ST_SUCCESS;
  1066. #ifdef __MMI_SUBLCD__
  1067.     /*----------------------------------------------------------------*/
  1068.     /* Local Variables                                                */
  1069.     /*----------------------------------------------------------------*/
  1070.     S16 count, i;
  1071.     /*----------------------------------------------------------------*/
  1072.     /* Code Body                                                      */
  1073.     /*----------------------------------------------------------------*/
  1074. #ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
  1075.     if (redraw_in_small_screen_proceduer())
  1076.     {
  1077.         return ST_SUCCESS;
  1078.     }
  1079. #endif /* __MMI_UI_SMALL_SCREEN_SUPPORT__ */ 
  1080.     MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_SUBHIST_DEL_SUBLCD_SCR_HDLR, ScrId));
  1081.     if (!IsSubLCDScreenPresent(ScrId))
  1082.     {
  1083.         return ST_FAILURE;
  1084.     }
  1085.     count = NodeIndex;
  1086.     /* Locating the screen */
  1087.     while (count)
  1088.     {
  1089.         if (SubLCDHistoryData[count].scrnID == ScrId)
  1090.         {
  1091.             /*
  1092.              * Not support for stop callback at this funciton 
  1093.              * Because the application want to delete the special screen in the history,
  1094.              * we don't need to check the return value of the delete callback function.
  1095.              * the behavior is the same with DeleteScreenIfPresent()
  1096.              */
  1097.             ExecHistoryScrnCallBackHandle_ex(count, 0);
  1098.             break;
  1099.         }
  1100.         --count;
  1101.     }
  1102.     if (Status)
  1103.     {
  1104.         /* Shifting All the nodes by one notch */
  1105.         for (i = count + 1; i <= NodeIndex; i++, count++)
  1106.         {
  1107.             memcpy(&SubLCDHistoryData[count], &SubLCDHistoryData[i], sizeof(SubLCDHistoryNode));
  1108.         }
  1109.         --NodeIndex;
  1110.         memset(&SubLCDHistoryData[NodeIndex + 1], 0, sizeof(SubLCDHistoryNode));
  1111.     }
  1112. #endif /* __MMI_SUBLCD__ */ 
  1113.     return Status;
  1114. }
  1115. /*****************************************************************************
  1116.  * FUNCTION
  1117.  *  DeleteNSubLCDHistory
  1118.  * DESCRIPTION
  1119.  *  Deletes 'n' history nodes from current Sub LCDhistory index
  1120.  *  
  1121.  *  This shall pop 'n' history nodes without invoking
  1122.  *  entry functions of the deleted nodes
  1123.  * PARAMETERS
  1124.  *  DeleteCount     [IN]        
  1125.  *  n(?)            [IN]        
  1126.  * RETURNS
  1127.  *  void
  1128.  *****************************************************************************/
  1129. void DeleteNSubLCDHistory(U16 DeleteCount)
  1130. {
  1131. #ifdef __MMI_SUBLCD__
  1132.     /*----------------------------------------------------------------*/
  1133.     /* Local Variables                                                */
  1134.     /*----------------------------------------------------------------*/
  1135.     S16 Count = 0;
  1136.     /*----------------------------------------------------------------*/
  1137.     /* Code Body                                                      */
  1138.     /*----------------------------------------------------------------*/
  1139. #ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
  1140.     if (redraw_in_small_screen_proceduer())
  1141.     {
  1142.         return ;
  1143.     }
  1144. #endif /* __MMI_UI_SMALL_SCREEN_SUPPORT__ */ 
  1145.     MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_SUBHIST_DEL_SUBLCD_SCR_NUM, DeleteCount));
  1146.     if (NodeIndex >= DeleteCount)
  1147.     {
  1148.         /* To make sure the callback will run at topist screen */
  1149.         ExecTopScrnCallbackHandler_ex(0);
  1150.         for (Count = DeleteCount; Count >= 1; --Count)
  1151.         {
  1152.             /* JL, if want to stop to run next decrement will return true. */
  1153.             if (ExecHistoryScrnCallBackHandle_ex(NodeIndex, 0) == MMI_HIST_STOP_DELETING)
  1154.             {
  1155.                 break;
  1156.             }
  1157.             DecrementSubLCD();
  1158.         }
  1159.     }
  1160. #endif /* __MMI_SUBLCD__ */ 
  1161. }
  1162. /*****************************************************************************
  1163.  * FUNCTION
  1164.  *  DeleteBeyondSubLCDScrTillScr
  1165.  * DESCRIPTION
  1166.  *  To delete scrns beyond scrn A
  1167.  *  till scrn B
  1168.  * PARAMETERS
  1169.  *  beyondScrnid        [IN]        
  1170.  *  tillScrnid          [IN]        
  1171.  *  scrnid1(?)          [IN]        
  1172.  *  scrnid2(?)          [IN]        
  1173.  * RETURNS
  1174.  *  U16 - status
  1175.  *****************************************************************************/
  1176. U8 DeleteBeyondSubLCDScrTillScr(U16 beyondScrnid, U16 tillScrnid)
  1177. {
  1178.     U8 Status = ST_SUCCESS;
  1179. #ifdef __MMI_SUBLCD__
  1180.     /*----------------------------------------------------------------*/
  1181.     /* Local Variables                                                */
  1182.     /*----------------------------------------------------------------*/
  1183.     S16 count = 0, count1 = 0;
  1184.     S16 endScreenPresent = -1, startScreenPresent = -1;
  1185.     U16 screensDeleted = 0;
  1186.     /*----------------------------------------------------------------*/
  1187.     /* Code Body                                                      */
  1188.     /*----------------------------------------------------------------*/
  1189. #ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
  1190.     if (redraw_in_small_screen_proceduer())
  1191.     {
  1192.         return ST_SUCCESS;
  1193.     }
  1194. #endif /* __MMI_UI_SMALL_SCREEN_SUPPORT__ */ 
  1195.     MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_SUBHIST_DEL_BEYOND_TILL_SUBLCD_SCR_HDLR, beyondScrnid, tillScrnid));
  1196.     if (!IsSubLCDScreenPresent(beyondScrnid) || !IsSubLCDScreenPresent(tillScrnid))
  1197.     {
  1198.         return ST_FAILURE;
  1199.     }
  1200.     if (NodeIndex > 0)
  1201.     {
  1202.         count = NodeIndex;
  1203.         count1 = NodeIndex;
  1204.     }
  1205.     while (count)
  1206.     {
  1207.         if (SubLCDHistoryData[count].scrnID == beyondScrnid)
  1208.         {
  1209.             startScreenPresent = count;
  1210.         }
  1211.         if (SubLCDHistoryData[count].scrnID == tillScrnid)
  1212.         {
  1213.             MMI_ASSERT(startScreenPresent != -1);
  1214.             endScreenPresent = count;
  1215.             break;
  1216.         }
  1217.         --count;
  1218.     }
  1219.     MMI_ASSERT((startScreenPresent != -1) && (endScreenPresent != -1));
  1220.     for (count = startScreenPresent - 1; count >= endScreenPresent; count--)
  1221.     {
  1222.         if (ExecHistoryScrnCallBackHandle_ex(count, 0) == MMI_HIST_STOP_DELETING)
  1223.         {
  1224.             /*
  1225.              * The screen won't want to delete. 
  1226.              * We stop continue to delete the screens.
  1227.              */
  1228.             endScreenPresent = count + 1;
  1229.             Status = ST_FAILURE;
  1230.             break;
  1231.         }
  1232.         if (SubLCDHistoryData[count].guiBuffer)
  1233.         {
  1234.             OslMfree(SubLCDHistoryData[count].guiBuffer);
  1235.         }
  1236.         memset(&SubLCDHistoryData[count], 0, sizeof(SubLCDHistoryNode));
  1237.         NodeIndex--;
  1238.         screensDeleted++;
  1239.     }
  1240.     memcpy(
  1241.         SubLCDHistoryData + endScreenPresent,
  1242.         SubLCDHistoryData + startScreenPresent,
  1243.         sizeof(SubLCDHistoryNode) * (count1 - startScreenPresent + 1));
  1244.     memset(SubLCDHistoryData + (NodeIndex + 1), 0, (sizeof(SubLCDHistoryNode) * screensDeleted));
  1245. #endif /* __MMI_SUBLCD__ */ 
  1246.     return Status;
  1247. }
  1248. /*****************************************************************************
  1249.  * FUNCTION
  1250.  *  DeleteBetweenSubLCDScreen
  1251.  * DESCRIPTION
  1252.  *  Deletes Between two Screens including the boundaries
  1253.  * PARAMETERS
  1254.  *  StartScrId      [IN]        
  1255.  *  EndScrId        [IN]        
  1256.  * RETURNS
  1257.  *  U16 - status
  1258.  *****************************************************************************/
  1259. U16 DeleteBetweenSubLCDScreen(U16 StartScrId, U16 EndScrId)
  1260. {
  1261.     U8 Status = ST_SUCCESS;
  1262. #ifdef __MMI_SUBLCD__
  1263.     /*----------------------------------------------------------------*/
  1264.     /* Local Variables                                                */
  1265.     /*----------------------------------------------------------------*/
  1266.     S16 count = 0, count1 = 0;
  1267.     S16 endScreenPresent = -1, startScreenPresent = -1;
  1268.     U16 screensDeleted = 0;
  1269.     /*----------------------------------------------------------------*/
  1270.     /* Code Body                                                      */
  1271.     /*----------------------------------------------------------------*/
  1272. #ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
  1273.     if (redraw_in_small_screen_proceduer())
  1274.     {
  1275.         return ST_SUCCESS;
  1276.     }
  1277. #endif /* __MMI_UI_SMALL_SCREEN_SUPPORT__ */ 
  1278.     MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_SUBHIST_DEL_BETWEEN_SUBLCD_SCR_HDLR, StartScrId, EndScrId));
  1279.     if (!IsSubLCDScreenPresent(StartScrId) || !IsSubLCDScreenPresent(EndScrId))
  1280.     {
  1281.         return ST_FAILURE;
  1282.     }
  1283.     if (NodeIndex > 0)
  1284.     {
  1285.         count = NodeIndex;
  1286.         count1 = NodeIndex;
  1287.     }
  1288.     while (count >= 0)
  1289.     {
  1290.         if (SubLCDHistoryData[count].scrnID == EndScrId)
  1291.         {
  1292.             startScreenPresent = count;
  1293.         }
  1294.         if (SubLCDHistoryData[count].scrnID == StartScrId)
  1295.         {
  1296.             endScreenPresent = count;
  1297.             break;
  1298.         }
  1299.         --count;
  1300.     }
  1301.     MMI_ASSERT((startScreenPresent != -1) && (endScreenPresent != -1));
  1302.     for (count = startScreenPresent; count >= endScreenPresent; count--)
  1303.     {
  1304.         if (ExecHistoryScrnCallBackHandle_ex(count, 0) == MMI_HIST_STOP_DELETING)
  1305.         {
  1306.             /*
  1307.              * The screen won't want to delete. 
  1308.              * We stop continue to delete the screens.
  1309.              */
  1310.             endScreenPresent = count + 1;
  1311.             Status = ST_FAILURE;
  1312.             break;
  1313.         }
  1314.         if (SubLCDHistoryData[count].guiBuffer)
  1315.         {
  1316.             OslMfree(SubLCDHistoryData[count].guiBuffer);
  1317.         }
  1318.         memset(&SubLCDHistoryData[count], 0, sizeof(SubLCDHistoryNode));
  1319.         NodeIndex--;
  1320.         screensDeleted++;
  1321.     }
  1322.     memcpy(
  1323.         SubLCDHistoryData + endScreenPresent,
  1324.         SubLCDHistoryData + startScreenPresent + 1,
  1325.         sizeof(SubLCDHistoryNode) * (count1 - startScreenPresent + 1));
  1326.     memset(SubLCDHistoryData + (NodeIndex + 1), 0, (sizeof(SubLCDHistoryNode) * screensDeleted));
  1327. #endif /* __MMI_SUBLCD__ */ 
  1328.     return Status;
  1329. }
  1330. /*****************************************************************************
  1331.  * FUNCTION
  1332.  *  SubLCDHistoryReplace
  1333.  * DESCRIPTION
  1334.  *  To replace a specific history
  1335.  *  
  1336.  *  HistoryReplace will be used for a exist history
  1337.  * PARAMETERS
  1338.  *  out_scrn_id     [IN]        
  1339.  *  in_scrn_id      [IN]        
  1340.  *  in_src_func     [IN]        
  1341.  * RETURNS
  1342.  *  pBool
  1343.  *****************************************************************************/
  1344. pBOOL SubLCDHistoryReplace(U16 out_scrn_id, U16 in_scrn_id, FuncPtr in_src_func)
  1345. {
  1346. #ifdef __MMI_SUBLCD__
  1347.     /*----------------------------------------------------------------*/
  1348.     /* Local Variables                                                */
  1349.     /*----------------------------------------------------------------*/
  1350.     S16 count = 0;
  1351.     /*----------------------------------------------------------------*/
  1352.     /* Code Body                                                      */
  1353.     /*----------------------------------------------------------------*/
  1354.     MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_SUBHIST_REPLACE_SUBLCD_SCR_HDLR, out_scrn_id, in_scrn_id, in_src_func));
  1355.     for (count = 0; ((count < MAX_SUBLCD_HISTORY) && ((count <= NodeIndex) && (NodeIndex != -1))); count++)
  1356.     {
  1357.         /* Find the matched source history and then to write into destinate history */
  1358.         if (SubLCDHistoryData[count].scrnID == out_scrn_id)
  1359.         {
  1360.             ClearDelScrnIDCallbackHandler(out_scrn_id, NULL);
  1361.             SubLCDHistoryData[count].scrnID = in_scrn_id;
  1362.             SubLCDHistoryData[count].entryFuncPtr = in_src_func;
  1363.             if (SubLCDHistoryData[count].guiBuffer)
  1364.             {
  1365.                 OslMfree(SubLCDHistoryData[count].guiBuffer);
  1366.             }
  1367.             SubLCDHistoryData[count].guiBuffer = NULL;
  1368.             SubLCDHistoryData[count].guiLen = 0;
  1369.             return MMI_TRUE;
  1370.         }
  1371.     }
  1372. #endif /* __MMI_SUBLCD__ */ 
  1373.     return MMI_FALSE;
  1374. }
  1375. /*****************************************************************************
  1376.  * FUNCTION
  1377.  *  IsSubLCDScreenPresent
  1378.  * DESCRIPTION
  1379.  *  Queries history for presence of a screen Id in sub-LCD history
  1380.  * PARAMETERS
  1381.  *  scrnId          [IN]        
  1382.  *  scrnid(?)       [IN]        
  1383.  * RETURNS
  1384.  *  pBOOL
  1385.  *****************************************************************************/
  1386. pBOOL IsSubLCDScreenPresent(U16 scrnId)
  1387. {
  1388. #ifdef __MMI_SUBLCD__
  1389.     /*----------------------------------------------------------------*/
  1390.     /* Local Variables                                                */
  1391.     /*----------------------------------------------------------------*/
  1392.     S16 count;
  1393.     /*----------------------------------------------------------------*/
  1394.     /* Code Body                                                      */
  1395.     /*----------------------------------------------------------------*/
  1396.     for (count = 0; ((count < MAX_SUBLCD_HISTORY) && ((count <= NodeIndex) && (NodeIndex != -1))); count++)
  1397.     {
  1398.         if (SubLCDHistoryData[count].scrnID == scrnId)
  1399.         {
  1400.             return TRUE;
  1401.         }
  1402.     }
  1403. #endif /* __MMI_SUBLCD__ */ 
  1404.     return FALSE;
  1405. }
  1406. /*****************************************************************************
  1407.  * FUNCTION
  1408.  *  GetCurrSubLCDScreenExitFunc
  1409.  * DESCRIPTION
  1410.  *  Queries present screen exit function
  1411.  * PARAMETERS
  1412.  *  void
  1413.  * RETURNS
  1414.  *  FuncPtr
  1415.  *****************************************************************************/
  1416. FuncPtr GetCurrSubLCDScreenExitFunc(void)
  1417. {
  1418.     /*----------------------------------------------------------------*/
  1419.     /* Local Variables                                                */
  1420.     /*----------------------------------------------------------------*/
  1421.     /*----------------------------------------------------------------*/
  1422.     /* Code Body                                                      */
  1423.     /*----------------------------------------------------------------*/
  1424. #ifdef __MMI_SUBLCD__
  1425.     return gCurrExitSubLCDFn;
  1426. #endif 
  1427.     return 0;
  1428. }
  1429. /*****************************************************************************
  1430.  * FUNCTION
  1431.  *  GetCurrSubLCDScreenEntryFunc
  1432.  * DESCRIPTION
  1433.  *  Queries current screen entry function
  1434.  * PARAMETERS
  1435.  *  void
  1436.  * RETURNS
  1437.  *  FuncPtr
  1438.  *****************************************************************************/
  1439. FuncPtr GetCurrSubLCDScreenEntryFunc(void)
  1440. {
  1441.     /*----------------------------------------------------------------*/
  1442.     /* Local Variables                                                */
  1443.     /*----------------------------------------------------------------*/
  1444.     /*----------------------------------------------------------------*/
  1445.     /* Code Body                                                      */
  1446.     /*----------------------------------------------------------------*/
  1447. #ifdef __MMI_SUBLCD__
  1448.     return gCurrEntrySubLCDFn;
  1449. #endif 
  1450.     return 0;
  1451. }
  1452. /*****************************************************************************
  1453.  * FUNCTION
  1454.  *  GetSubLCDScreenCountInHistory
  1455.  * DESCRIPTION
  1456.  *  Get the screen numbers in subLCD history
  1457.  * PARAMETERS
  1458.  *  void
  1459.  * RETURNS
  1460.  *  S16 - screen count
  1461.  *****************************************************************************/
  1462. S16 GetSubLCDScreenCountInHistory(void)
  1463. {
  1464.     /*----------------------------------------------------------------*/
  1465.     /* Local Variables                                                */
  1466.     /*----------------------------------------------------------------*/
  1467.     /*----------------------------------------------------------------*/
  1468.     /* Code Body                                                      */
  1469.     /*----------------------------------------------------------------*/
  1470. #ifdef __MMI_SUBLCD__
  1471.     return (S16)(NodeIndex + 1);
  1472. #endif 
  1473.     return 0;
  1474. }
  1475. /*****************************************************************************
  1476.  * FUNCTION
  1477.  *  GetSubLCDHistory
  1478.  * DESCRIPTION
  1479.  *  Used to get sub LCD history buffer for a screen id
  1480.  * PARAMETERS
  1481.  *  scrnId          [IN]        
  1482.  *  ptrHistory      [?]         
  1483.  *  scrnID(?)       [IN]        History *ptrHistory
  1484.  * RETURNS
  1485.  *  FuncPtr
  1486.  *****************************************************************************/
  1487. U8 GetSubLCDHistory(U16 scrnId, SubLCDHistoryNodeEx *ptrHistory)
  1488. {
  1489. #ifdef __MMI_SUBLCD__
  1490.     /*----------------------------------------------------------------*/
  1491.     /* Local Variables                                                */
  1492.     /*----------------------------------------------------------------*/
  1493.     S16 count;
  1494.     /*----------------------------------------------------------------*/
  1495.     /* Code Body                                                      */
  1496.     /*----------------------------------------------------------------*/
  1497.     for (count = 0; ((count < MAX_SUBLCD_HISTORY) && ((count <= NodeIndex) && (NodeIndex != -1))); count++)
  1498.     {
  1499.         if (SubLCDHistoryData[count].scrnID == scrnId)
  1500.         {
  1501.             ptrHistory->scrnID = SubLCDHistoryData[count].scrnID;
  1502.             ptrHistory->entryFuncPtr = SubLCDHistoryData[count].entryFuncPtr;
  1503.             if (SubLCDHistoryData[count].guiLen)
  1504.             {
  1505.                 memcpy(ptrHistory->guiBuffer, SubLCDHistoryData[count].guiBuffer, MAX_GUI_BUFFER);
  1506.             }
  1507.             else
  1508.             {
  1509.                 memset(ptrHistory->guiBuffer, 0, MAX_GUI_BUFFER);
  1510.             }
  1511.             return TRUE;
  1512.         }
  1513.     }
  1514. #endif /* __MMI_SUBLCD__ */ 
  1515.     return FALSE;
  1516. }
  1517. /*****************************************************************************
  1518.  * FUNCTION
  1519.  *  GetCurrSubLCDGuiBuffer
  1520.  * DESCRIPTION
  1521.  *  gets current Sub LCD screen gui buffer
  1522.  * PARAMETERS
  1523.  *  scrnId          [IN]        
  1524.  *  scrnid(?)       [IN]        
  1525.  * RETURNS
  1526.  *  FuncPtr
  1527.  *****************************************************************************/
  1528. U8 *GetCurrSubLCDGuiBuffer(U16 scrnId)
  1529. {
  1530. #ifdef __MMI_SUBLCD__
  1531.     /*----------------------------------------------------------------*/
  1532.     /* Local Variables                                                */
  1533.     /*----------------------------------------------------------------*/
  1534.     S16 count;
  1535.     /*----------------------------------------------------------------*/
  1536.     /* Code Body                                                      */
  1537.     /*----------------------------------------------------------------*/
  1538.     for (count = 0; ((count < MAX_SUBLCD_HISTORY) && ((count <= NodeIndex) && (NodeIndex != -1))); count++)
  1539.     {
  1540.         if (SubLCDHistoryData[count].scrnID == scrnId)
  1541.         {
  1542.             return SubLCDHistoryData[count].guiBuffer;
  1543.         }
  1544.     }
  1545. #endif /* __MMI_SUBLCD__ */ 
  1546.     return NULL;
  1547. }
  1548. /*****************************************************************************
  1549.  * FUNCTION
  1550.  *  GetPreviousSubLCDScrnIdOf
  1551.  * DESCRIPTION
  1552.  *  Queries previous scrn id of this Id
  1553.  * PARAMETERS
  1554.  *  scrnId              [IN]        
  1555.  *  previousScrnId      [?]         
  1556.  *  scrnid(?)           [IN]        
  1557.  * RETURNS
  1558.  *  FuncPtr
  1559.  *****************************************************************************/
  1560. pBOOL GetPreviousSubLCDScrnIdOf(U16 scrnId, U16 *previousScrnId)
  1561. {
  1562. #ifdef __MMI_SUBLCD__
  1563.     /*----------------------------------------------------------------*/
  1564.     /* Local Variables                                                */
  1565.     /*----------------------------------------------------------------*/
  1566.     S16 count;
  1567.     /*----------------------------------------------------------------*/
  1568.     /* Code Body                                                      */
  1569.     /*----------------------------------------------------------------*/
  1570.     for (count = 0; ((count < MAX_SUBLCD_HISTORY) && ((count <= NodeIndex) && (NodeIndex != -1))); count++)
  1571.     {
  1572.         if (SubLCDHistoryData[count].scrnID == scrnId)
  1573.         {
  1574.             if ((count - 1) >= 0)
  1575.             {
  1576.                 *previousScrnId = SubLCDHistoryData[count - 1].scrnID;
  1577.                 return MMI_TRUE;
  1578.             }
  1579.             return MMI_FALSE;
  1580.         }
  1581.     }
  1582. #endif /* __MMI_SUBLCD__ */ 
  1583.     return MMI_FALSE;
  1584. }
  1585. /*****************************************************************************
  1586.  * FUNCTION
  1587.  *  GetNextSubLCDScrnIdOf
  1588.  * DESCRIPTION
  1589.  *  Queries next scrn id of this Id
  1590.  * PARAMETERS
  1591.  *  scrnId          [IN]        
  1592.  *  nextScrnId      [?]         
  1593.  *  scrnid(?)       [IN]        
  1594.  * RETURNS
  1595.  *  FuncPtr
  1596.  *****************************************************************************/
  1597. pBOOL GetNextSubLCDScrnIdOf(U16 scrnId, U16 *nextScrnId)
  1598. {
  1599. #ifdef __MMI_SUBLCD__
  1600.     /*----------------------------------------------------------------*/
  1601.     /* Local Variables                                                */
  1602.     /*----------------------------------------------------------------*/
  1603.     S16 count;
  1604.     /*----------------------------------------------------------------*/
  1605.     /* Code Body                                                      */
  1606.     /*----------------------------------------------------------------*/
  1607.     for (count = 0; ((count < MAX_SUBLCD_HISTORY) && ((count <= NodeIndex) && (NodeIndex != -1))); count++)
  1608.     {
  1609.         if (SubLCDHistoryData[count].scrnID == scrnId)
  1610.         {
  1611.             if ((count + 1) <= NodeIndex)
  1612.             {
  1613.                 *nextScrnId = SubLCDHistoryData[count + 1].scrnID;
  1614.                 return MMI_TRUE;
  1615.             }
  1616.             return MMI_FALSE;
  1617.         }
  1618.     }
  1619. #endif /* __MMI_SUBLCD__ */ 
  1620.     return MMI_FALSE;
  1621. }
  1622. /*****************************************************************************
  1623.  * FUNCTION
  1624.  *  GetSubLCActiveScreenId
  1625.  * DESCRIPTION
  1626.  *  Get current screen id of Sub LCD
  1627.  *  
  1628.  *  This is used to clear all the interrupt event handlers
  1629.  * PARAMETERS
  1630.  *  void
  1631.  * RETURNS
  1632.  *  void
  1633.  *****************************************************************************/
  1634. U16 GetSubLCActiveScreenId(void)
  1635. {
  1636. #ifdef __MMI_SUBLCD__
  1637.     /*----------------------------------------------------------------*/
  1638.     /* Local Variables                                                */
  1639.     /*----------------------------------------------------------------*/
  1640.     /*----------------------------------------------------------------*/
  1641.     /* Code Body                                                      */
  1642.     /*----------------------------------------------------------------*/
  1643.     return gCurrTopSubLCDScrnID;
  1644. #endif /* __MMI_SUBLCD__ */ 
  1645.     return 0;
  1646. }
  1647. /*****************************************************************************
  1648.  * FUNCTION
  1649.  *  GetSubLCDExitScrnId
  1650.  * DESCRIPTION
  1651.  *  Gets current exit screen id of Sub LCD
  1652.  * PARAMETERS
  1653.  *  void
  1654.  *  U16(?)      [IN]        Scrnid
  1655.  * RETURNS
  1656.  *  FuncPtr
  1657.  *****************************************************************************/
  1658. U16 GetSubLCDExitScrnId(void)
  1659. {
  1660. #ifdef __MMI_SUBLCD__
  1661.     /*----------------------------------------------------------------*/
  1662.     /* Local Variables                                                */
  1663.     /*----------------------------------------------------------------*/
  1664.     /*----------------------------------------------------------------*/
  1665.     /* Code Body                                                      */
  1666.     /*----------------------------------------------------------------*/
  1667.     return gCurrExitSubLCDScrnID;
  1668. #endif /* __MMI_SUBLCD__ */ 
  1669.     return 0;
  1670. }
  1671. /*****************************************************************************
  1672.  * FUNCTION
  1673.  *  GetSubLCDScrnId
  1674.  * DESCRIPTION
  1675.  *  Gets the id of Sub LCD screen
  1676.  * PARAMETERS
  1677.  *  index       [IN]        
  1678.  * RETURNS
  1679.  *  FuncPtr
  1680.  *****************************************************************************/
  1681. U16 GetSubLCDScrnId(U16 index)
  1682. {
  1683. #ifdef __MMI_SUBLCD__
  1684.     /*----------------------------------------------------------------*/
  1685.     /* Local Variables                                                */
  1686.     /*----------------------------------------------------------------*/
  1687.     /*----------------------------------------------------------------*/
  1688.     /* Code Body                                                      */
  1689.     /*----------------------------------------------------------------*/
  1690.     if (index <= NodeIndex)
  1691.     {
  1692.         return (SubLCDHistoryData[index].scrnID);
  1693.     }
  1694. #endif /* __MMI_SUBLCD__ */ 
  1695.     return 0;
  1696. }
  1697. /*****************************************************************************
  1698.  * FUNCTION
  1699.  *  SubLCDHistoryDump
  1700.  * DESCRIPTION
  1701.  *  Dumps the Sub-LCD history to file or debug window
  1702.  *  
  1703.  *  SubLCDHistoryDump will be used for dbugging purposes
  1704.  * PARAMETERS
  1705.  *  void
  1706.  * RETURNS
  1707.  *  void
  1708.  *****************************************************************************/
  1709. void SubLCDHistoryDump(void)
  1710. {
  1711. #ifdef __MMI_SUBLCD__
  1712.     /*----------------------------------------------------------------*/
  1713.     /* Local Variables                                                */
  1714.     /*----------------------------------------------------------------*/
  1715.     S16 count = 0;
  1716.     /*----------------------------------------------------------------*/
  1717.     /* Code Body                                                      */
  1718.     /*----------------------------------------------------------------*/
  1719.     if (NodeIndex >= 0)
  1720.     {
  1721.         count = NodeIndex;
  1722.         do
  1723.         {
  1724.             MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_SUBHIST_DUMP_HDLR,
  1725.                        count, SubLCDHistoryData[count].scrnID, SubLCDHistoryData[count].entryFuncPtr));
  1726.             if (count > 0 && count < MAX_SUBLCD_HISTORY)
  1727.             {
  1728.                 --count;
  1729.             }
  1730.             else
  1731.             {
  1732.                 break;
  1733.             }
  1734.         } while ((count != NodeIndex) && (SubLCDHistoryData[count].entryFuncPtr != NULL));
  1735.     }
  1736.     MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_SUBHIST_DUMP_ROOTHDLR));
  1737. #endif /* __MMI_SUBLCD__ */ 
  1738. }
  1739. #ifdef __MMI_UI_TAB_PANE__
  1740. /*****************************************************************************
  1741.  * FUNCTION
  1742.  *  disable_subLCD_history_saving
  1743.  * DESCRIPTION
  1744.  *  Disable SubLCD history saving
  1745.  * PARAMETERS
  1746.  *  void
  1747.  * RETURNS
  1748.  *  void
  1749.  *****************************************************************************/
  1750. void disable_subLCD_history_saving(void)
  1751. {
  1752.     /*----------------------------------------------------------------*/
  1753.     /* Local Variables                                                */
  1754.     /*----------------------------------------------------------------*/
  1755.     /*----------------------------------------------------------------*/
  1756.     /* Code Body                                                      */
  1757.     /*----------------------------------------------------------------*/
  1758. #ifdef __MMI_SUBLCD__
  1759.     disable_subLCD_history_save = 1;
  1760. #endif 
  1761. }
  1762. /*****************************************************************************
  1763.  * FUNCTION
  1764.  *  enable_subLCD_history_saving
  1765.  * DESCRIPTION
  1766.  *  Enables SubLCD history saving
  1767.  * PARAMETERS
  1768.  *  void
  1769.  * RETURNS
  1770.  *  void
  1771.  *****************************************************************************/
  1772. void enable_subLCD_history_saving(void)
  1773. {
  1774.     /*----------------------------------------------------------------*/
  1775.     /* Local Variables                                                */
  1776.     /*----------------------------------------------------------------*/
  1777.     /*----------------------------------------------------------------*/
  1778.     /* Code Body                                                      */
  1779.     /*----------------------------------------------------------------*/
  1780. #ifdef __MMI_SUBLCD__
  1781.     disable_subLCD_history_save = 0;
  1782. #endif 
  1783. }
  1784. /*****************************************************************************
  1785.  * FUNCTION
  1786.  *  change_curr_subLCD_gui_buffer
  1787.  * DESCRIPTION
  1788.  *  Changes the current subLCD gui buffer of the current screen
  1789.  *  
  1790.  *  This is used by tab pane as as tab pane history is on top of the screen.
  1791.  * PARAMETERS
  1792.  *  gui_buffer      [?]     
  1793.  * RETURNS
  1794.  *  void
  1795.  *****************************************************************************/
  1796. void change_curr_subLCD_gui_buffer(U8 *gui_buffer)
  1797. {
  1798. #ifdef __MMI_SUBLCD__
  1799.     /*----------------------------------------------------------------*/
  1800.     /* Local Variables                                                */
  1801.     /*----------------------------------------------------------------*/
  1802.     /*----------------------------------------------------------------*/
  1803.     /* Code Body                                                      */
  1804.     /*----------------------------------------------------------------*/
  1805.     if (SubLCDHistoryData[NodeIndex].guiBuffer != NULL)
  1806.     {
  1807.         memcpy(SubLCDHistoryData[NodeIndex].guiBuffer, gui_buffer, MAX_GUI_BUFFER);
  1808.     }
  1809. #endif /* __MMI_SUBLCD__ */ 
  1810. }
  1811. #endif /* __MMI_UI_TAB_PANE__ */