📄 history.c
字号:
* Deletes Between two Screens including the boundaries
* PARAMETERS
* StartScrId [IN]
* EndScrId [IN]
* RETURNS
* U16 - status
*****************************************************************************/
U16 DeleteBetweenScreen(U16 StartScrId, U16 EndScrId)
{
/*----------------------------------------------------------------*/
/* 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_BETWEEN_SCR_HDLR, StartScrId, EndScrId));
if (currHistoryIndex > 0)
{
count = currHistoryIndex;
count1 = currHistoryIndex;
}
while (count)
{
if (historyData[count].scrnID == EndScrId)
{
startScreenPresent = count;
break;
}
--count;
}
if (startScreenPresent >= 0)
{
while (count)
{
if (historyData[count].scrnID == StartScrId)
{
endScreenPresent = count;
break;
}
--count;
}
}
else
{
return ST_FAILURE;
}
MMI_ASSERT((startScreenPresent != -1) && (endScreenPresent != -1));
for (count = startScreenPresent; 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);
currHistoryIndex--;
screensDeleted++;
if (count == 0)
{
/* count is U16 not S16 */
break;
}
}
memcpy(
historyData + endScreenPresent,
historyData + startScreenPresent + 1,
sizeof(historyNode) * (count1 - startScreenPresent + 1));
memset(historyData + (currHistoryIndex + 1), 0, (sizeof(historyNode) * screensDeleted));
return ST_SUCCESS;
}
/*****************************************************************************
* FUNCTION
* DeleteScreenIfPresent
* DESCRIPTION
* Deletes Screen from History
* PARAMETERS
* ScrId [IN]
* RETURNS
* U16 - status
*****************************************************************************/
U16 DeleteScreenIfPresent(U16 ScrId)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U16 count, i;
/*----------------------------------------------------------------*/
/* 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_SCR_IF_PRESENT_HDLR, ScrId));
if (!IsScreenPresent(ScrId))
{
return ST_FAILURE;
}
count = currHistoryIndex;
/* Locating the screen */
while (count)
{
if (historyData[count].scrnID == ScrId)
{
break;
}
--count;
}
/*
* Not support for stop callback at this funciton
* Because the application want to delete the special screen in the history,
* we don't need to check the return value of the delete callback function.
*/
ExecHistoryScrnCallBackHandle(count);
/* Deleting the node */
mmi_free_history_buffer(count);
/* Shifting All the nodes by one notch */
for (i = count + 1; i <= currHistoryIndex; i++, count++)
{
memcpy(&historyData[count], &historyData[i], sizeof(historyNode));
}
--currHistoryIndex;
memset(&historyData[currHistoryIndex + 1], 0, sizeof(historyNode));
return ST_SUCCESS;
}
/*****************************************************************************
* FUNCTION
* DeleteScreenFromToNnodes
* DESCRIPTION
* Deletes N nodes from History starting from a particular screen
* PARAMETERS
* ScrId [IN]
* num_nodes [IN]
* RETURNS
* U16 - status
*****************************************************************************/
U16 DeleteScreenFromToNnodes(U16 ScrId, U16 num_nodes)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U16 count, i;
U16 temp = 0;
U16 k = 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_SCR_FROM_TO_N_NODE_HDLR, ScrId, num_nodes));
if (!IsScreenPresent(ScrId))
{
return ST_FAILURE;
}
count = currHistoryIndex;
/* Locating the screen */
while (count)
{
if (historyData[count].scrnID == ScrId)
{
break;
}
--count;
}
for (temp = 0; temp < num_nodes; temp++)
{
/* Not support for stop callback at this funciton */
if (ExecHistoryScrnCallBackHandle(count) == MMI_HIST_STOP_DELETING)
{
/*
* The screen won't want to delete.
* We stop continue to delete the screens.
*/
return ST_FAILURE;
}
/* Deleting the node */
mmi_free_history_buffer(count);
/* Shifting All the nodes by one notch */
k = count;
for (i = k + 1; i <= currHistoryIndex; i++, k++)
{
memcpy(&historyData[k], &historyData[i], sizeof(historyNode));
}
currHistoryIndex--;
memset(&historyData[currHistoryIndex + 1], 0, sizeof(historyNode));
count--;
if ((count == 0) && ((temp + 1) < num_nodes))
{
return ST_FAILURE;
}
}
return ST_SUCCESS;
}
/*****************************************************************************
* FUNCTION
* DeleteFromScrUptoScr
* DESCRIPTION
* Deletes screen from start scrnid to before end scrnid
* (include start scrnid but not include end scrnid)
* PARAMETERS
* start_scrnid [IN]
* upto_scrnid [IN]
* RETURNS
* U16 - status
*****************************************************************************/
U8 DeleteFromScrUptoScr(U16 start_scrnid, U16 upto_scrnid)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U8 Status = ST_SUCCESS;
S16 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_FROM_SCR_UPTO_SCR_HDLR, start_scrnid, upto_scrnid));
if (currHistoryIndex > 0)
{
count = currHistoryIndex;
count1 = currHistoryIndex;
}
while (count)
{
if (historyData[count].scrnID == start_scrnid)
{
startScreenPresent = count;
break;
}
--count;
}
if (startScreenPresent > 0)
{
--count;
/* if tillscrn is at index 0 */
while (count || ((count == 0) && (historyData[0].scrnID == upto_scrnid)))
{
if (historyData[count].scrnID == upto_scrnid)
{
endScreenPresent = count;
break;
}
--count;
}
}
else
{
return ST_FAILURE;
}
MMI_ASSERT((startScreenPresent != -1) && (endScreenPresent != -1));
for (count = startScreenPresent; 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++;
}
memcpy(
historyData + endScreenPresent + 1,
historyData + startScreenPresent + 1,
sizeof(historyNode) * (count1 - startScreenPresent));
memset(historyData + (currHistoryIndex + 1), 0, (sizeof(historyNode) * screensDeleted));
return Status;
}
/*****************************************************************************
* FUNCTION
* InsertHistoryBeforeThisScrnReference
* DESCRIPTION
* Insert new screen into history before this screen
* PARAMETERS
* scrnId [IN]
* addHistory [IN]
* RETURNS
* void
*****************************************************************************/
void InsertHistoryBeforeThisScrnReference(U16 scrnId, history *addHistory)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U16 count = 0;
U16 i = 0;
S32 len = 0;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* find this screen in history */
if (!IsScreenPresent(scrnId))
{
return;
}
MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_INSERT_HIST_BEFORE_SCREEN_HDLR, scrnId));
count = currHistoryIndex;
/* Locating the screen */
while (count)
{
if (historyData[count].scrnID == scrnId)
{
break;
}
--count;
}
increment();
/* Shifting All the nodes by one notch */
for (i = currHistoryIndex; i != count; i--)
{
memcpy(&historyData[i], &historyData[i - 1], sizeof(historyNode));
}
/* insert new screen in hostory */
memset(&historyData[count], 0, sizeof(historyNode));
historyData[count].scrnID = addHistory->scrnID;
historyData[count].entryFuncPtr = addHistory->entryFuncPtr;
len = pfnUnicodeStrlen((PS8) addHistory->inputBuffer);
if (len)
{
historyData[count].inputBuffer = OslMalloc(len * ENCODING_LENGTH + ENCODING_LENGTH);
pfnUnicodeStrcpy((PS8) historyData[count].inputBuffer, (PS8) addHistory->inputBuffer);
}
historyData[count].guiBuffer = OslMalloc(MAX_GUI_BUFFER);
memcpy(historyData[count].guiBuffer, addHistory->guiBuffer, MAX_GUI_BUFFER);
/* return success */
return;
}
/*****************************************************************************
* FUNCTION
* GetScreenCountInHistory
* DESCRIPTION
* Get the screen numbers in the history
* PARAMETERS
* void
* RETURNS
*
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -