📄 history.c
字号:
* void
*****************************************************************************/
void GoBacknHistory(U16 nHistory)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
S16 Index = 0;
S16 Count = 0;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
#ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
if (redraw_in_small_screen_proceduer())
{
return;
}
#endif /* __MMI_UI_SMALL_SCREEN_SUPPORT__ */
MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_HIST_GO_BACK_NHIST_HDLR, nHistory));
if (bRoundOffFlag)
{
Index = MAX_HISTORY + currHistoryIndex;
}
else
{
Index = currHistoryIndex;
}
if (Index >= nHistory)
{
for (Count = nHistory; Count >= 1; --Count)
{
/* JL, if want to stop to run next decrement will return true. */
if (decrement() == MMI_HIST_STOP_DELETING)
{
/* We abort the process here and don't handle original requirement */
break;
}
}
ExecutePopHistory();
}
}
/*****************************************************************************
* FUNCTION
* ExecutePopHistory
* DESCRIPTION
* executes current scrn & then deletes from history
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
static void ExecutePopHistory(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
#ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
if (redraw_in_small_screen_proceduer())
{
return;
}
#endif /* __MMI_UI_SMALL_SCREEN_SUPPORT__ */
MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_HIST_EXE_POP_HIST_HDLR, GetActiveScreenId(), GetExitScrnID(), IsBackHistory, CheckMainLCDHistoryBack));
IsBackHistory = MMI_TRUE;
CheckMainLCDHistoryBack = MMI_TRUE;
bBackHistoryFlag = MMI_TRUE;
if (historyData[currHistoryIndex].entryFuncPtr && currHistoryIndex > 0)
{
U16 id;
/* To make sure the callback will run at topist screen */
ExecTopScrnCallbackHandler();
//entryFuncPtr = (*(historyData[currHistoryIndex].entryFuncPtr));
//decrement(MMI_TRUE);
//entryFuncPtr();
id = historyData[currHistoryIndex].scrnID;
#ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
if (historyData[currHistoryIndex].isSmallScreen)
{
S32 i;
S32 tmp = currHistoryIndex;
i = currHistoryIndex - 1;
while (historyData[i].isSmallScreen && i > 0)
{
i--;
}
if ((currHistoryIndex == 0) || (i == 0 && historyData[i].isSmallScreen))
{
clear_screen();
}
redrawing_old_screens = MMI_HIST_SMALLSCREEN_ACTIVE;
MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_HIST_EXE_SMALL_SCREEN_BEGIN, currHistoryIndex, i));
gdi_lcd_freeze(TRUE);
#ifdef __MMI_INTERACTIVE_PROFILNG__
mmi_frm_profiling_interactive_start();
#endif
while ((i < currHistoryIndex) && (i >= 0))
{
currHistoryIndex = i;
IsBackHistory = MMI_TRUE;
CheckMainLCDHistoryBack = MMI_TRUE;
if (historyData[i].entryFuncPtr)
{
(*(historyData[i].entryFuncPtr)) ();
}
i++;
}
gdi_lcd_freeze(FALSE);
IsBackHistory = MMI_TRUE;
CheckMainLCDHistoryBack = MMI_TRUE;
redrawing_old_screens = MMI_HIST_SMALLSCREEN_ACTIVE_IN_EXIT_FUNC;
currHistoryIndex = tmp;
MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_HIST_EXE_SMALL_SCREEN_END, historyData[currHistoryIndex].scrnID, historyData[currHistoryIndex].entryFuncPtr));
if (historyData[currHistoryIndex].entryFuncPtr)
{
(*(historyData[currHistoryIndex].entryFuncPtr)) ();
}
#ifdef __MMI_INTERACTIVE_PROFILNG__
mmi_frm_profiling_interactive_end();
mmi_frm_profiling_interactive_show((U8*) L"S", MMI_FRM_PROFILING_MASK_1);
#endif /* __MMI_INTERACTIVE_PROFILNG__ */
if (id == historyData[currHistoryIndex].scrnID)
{
decrement();
}
/*
* We changet the small screen procedure state here.
* When we execute the last entry function,
* it also executed the previous exit function.
* We still don't want to add the history in that case.
*/
redrawing_old_screens = MMI_HIST_SMALLSCREEN_NONE;
}
else
#endif /* __MMI_UI_SMALL_SCREEN_SUPPORT__ */
{
#ifdef __MMI_INTERACTIVE_PROFILNG__
mmi_frm_profiling_interactive_start();
if (historyData[currHistoryIndex].entryFuncPtr)
{
(*(historyData[currHistoryIndex].entryFuncPtr)) ();
}
mmi_frm_profiling_interactive_end();
mmi_frm_profiling_interactive_show((U8*) L"S", MMI_FRM_PROFILING_MASK_1);
#else /* __MMI_INTERACTIVE_PROFILNG__ */
if (historyData[currHistoryIndex].entryFuncPtr)
{
(*(historyData[currHistoryIndex].entryFuncPtr)) ();
}
#endif /* __MMI_INTERACTIVE_PROFILNG__ */
if (id == historyData[currHistoryIndex].scrnID)
{
decrement();
}
}
}
else
{
extern void EntryIdleScreen(void);
/* To make sure the callback will run at topist screen */
ExecTopScrnCallbackHandler();
/* Go to idle screen */
currHistoryIndex = -1;
if ((historyData[0].entryFuncPtr))
{
#ifdef __MMI_INTERACTIVE_PROFILNG__
mmi_frm_profiling_interactive_start();
(*(historyData[0].entryFuncPtr)) ();
mmi_frm_profiling_interactive_end();
mmi_frm_profiling_interactive_show((U8*) L"S", MMI_FRM_PROFILING_MASK_1);
#else /* __MMI_INTERACTIVE_PROFILNG__ */
(*(historyData[0].entryFuncPtr)) ();
#endif /* __MMI_INTERACTIVE_PROFILNG__ */
}
if (historyData[0].entryFuncPtr != EntryIdleScreen)
{
/* EntryIdleScreen() will add the history in entry function */
mmi_free_history_buffer(0);
memset(&historyData[0], 0, sizeof(historyNode));
}
IsBackHistory = MMI_FALSE;
}
CheckMainLCDHistoryBack = MMI_FALSE;
bBackHistoryFlag = MMI_FALSE;
// reset delete CB flag, while go back screen.
//is_del_cb_found = MMI_FALSE; // gilbert --- for modifying decrement()
}
/*****************************************************************************
* FUNCTION
* GetCurrScrnId
* DESCRIPTION
* Gets the id of the screen on the top of history stack.
*
* This is used to get current screen input buffer
* PARAMETERS
* void
* RETURNS
* U16 - Current Screen Id
*****************************************************************************/
U16 GetCurrScrnId(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
return (historyData[currHistoryIndex].scrnID);
}
/*****************************************************************************
* FUNCTION
* DeleteScreens
* DESCRIPTION
* Deletes the screen IDs in the history
* The start screen ID and end screen ID will be deleted.
* If all screen IDs in the history are deleted
* successfully, the function returns ST_SUCCESS.
* If the parameters are error or someone screen
* ID can't be deleted successfully, the function
* returns ST_FAILURE.
* PARAMETERS
* start_scrnid [IN] IN the start screen ID (small number)
* end_scrnid [IN] IN the end screen ID (big number)
* RETURNS
* U8 - status
*****************************************************************************/
U8 DeleteScreens(U16 start_scrnid, U16 end_scrnid)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
S16 count = 0, del_cnt = 0, i = 0;
U8 Status = ST_SUCCESS;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
#ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
if (redraw_in_small_screen_proceduer())
{
return ST_SUCCESS;
}
#endif /* __MMI_UI_SMALL_SCREEN_SUPPORT__ */
MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_DEL_SCRS_HDLR, start_scrnid, end_scrnid));
count = currHistoryIndex;
if (start_scrnid > end_scrnid)
{
return ST_FAILURE;
}
while (count)
{
if ((start_scrnid <= historyData[count].scrnID) && (historyData[count].scrnID <= end_scrnid))
{
if (ExecHistoryScrnCallBackHandle(count) == MMI_HIST_STOP_DELETING)
{
/*
* The screen won't want to delete.
* We stop continue to delete the screens.
*/
Status = ST_FAILURE;
break;
}
del_cnt++;
/* Deleting the node */
mmi_free_history_buffer(count);
/* Shifting All the nodes by one notch */
for (i = 0; i <= (currHistoryIndex - count); i++)
{
memcpy(&historyData[count + i], &historyData[count + i + 1], sizeof(historyNode));
}
}
count--;
}
currHistoryIndex -= del_cnt;
MMI_ASSERT(currHistoryIndex>=0);
memset(&historyData[currHistoryIndex + 1], 0, sizeof(historyNode));
return Status;
}
/*****************************************************************************
* FUNCTION
* DeleteBeyondScrTillScr
* DESCRIPTION
* To delete scrns beyond scrn A
* till scrn B
* PARAMETERS
* beyondScrnid [IN]
* tillScrnid [IN]
* RETURNS
* U8 - status
*****************************************************************************/
U8 DeleteBeyondScrTillScr(U16 beyondScrnid, U16 tillScrnid)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U8 Status = ST_SUCCESS;
U16 count = 0, count1 = 0;
S16 endScreenPresent = -1, startScreenPresent = -1;
U16 screensDeleted = 0;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
#ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
if (redraw_in_small_screen_proceduer())
{
return ST_SUCCESS;
}
#endif /* __MMI_UI_SMALL_SCREEN_SUPPORT__ */
MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_HIST_DEL_BEYOND_SCR_TILL_SCR_HDLR, beyondScrnid, tillScrnid));
if (currHistoryIndex > 0)
{
count = currHistoryIndex;
count1 = currHistoryIndex;
}
while (count)
{
if (historyData[count].scrnID == beyondScrnid)
{
startScreenPresent = count;
break;
}
--count;
}
if (startScreenPresent > 0)
{
--count;
/* if tillscrn is at index 0 */
while (count || ((count == 0) && (historyData[0].scrnID == tillScrnid)))
{
if (historyData[count].scrnID == tillScrnid)
{
endScreenPresent = count;
break;
}
--count;
}
}
else
{
return ST_FAILURE;
}
MMI_ASSERT((startScreenPresent != -1) && (endScreenPresent != -1));
for (count = startScreenPresent - 1; count >= endScreenPresent; count--)
{
if (ExecHistoryScrnCallBackHandle(count) == MMI_HIST_STOP_DELETING)
{
/*
* The screen won't want to delete.
* We stop continue to delete the screens.
*/
endScreenPresent = count + 1;
Status = ST_FAILURE;
break;
}
mmi_free_history_buffer(count);
memset(&historyData[count], 0, sizeof(historyNode));
currHistoryIndex--;
screensDeleted++;
if (count == 0)
{
/* count is U16 not S16 */
break;
}
}
memcpy(
historyData + endScreenPresent,
historyData + startScreenPresent,
sizeof(historyNode) * (count1 - startScreenPresent + 1));
memset(historyData + (currHistoryIndex + 1), 0, (sizeof(historyNode) * screensDeleted));
return Status;
}
/*****************************************************************************
* FUNCTION
* DeleteBetweenScreen
* DESCRIPTION
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -