📄 history.c
字号:
{
if ((id >= 0) && (id <= currHistoryIndex))
{
if (historyData[id].guiBuffer)
{
OslMfree(historyData[id].guiBuffer);
historyData[id].guiBuffer = NULL;
}
if (historyData[id].inputBuffer)
{
if (historyData[id].mfreeFuncPtr)
{
historyData[id].mfreeFuncPtr(historyData[id].inputBuffer);
}
else
{
OslMfree(historyData[id].inputBuffer);
}
historyData[id].inputBuffer = NULL;
}
}
}
/*****************************************************************************
* FUNCTION
* increment
* DESCRIPTION
* increment the global currHistoryIndex
*
* increment the global currHistoryIndex
* PARAMETERS
* void
* RETURNS
* S16 - Current history index
*****************************************************************************/
S16 increment()
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (currHistoryIndex < MAX_HISTORY - 1)
{
++currHistoryIndex;
}
else
{
currHistoryIndex = MIN_HISTORY + 1;
bRoundOffFlag = 1;
}
return currHistoryIndex;
}
/*****************************************************************************
* FUNCTION
* decrement
* DESCRIPTION
* decrement the global currHistoryIndex
*
* decrement the global currHistoryIndex
* PARAMETERS
* void
* RETURNS
* S16 - current history index
*****************************************************************************/
static U8 decrement(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U8 is_stop_delete = MMI_HIST_ALLOW_DELETING; /* JL, if want to stop to run next decrement will return true. */
static U16 cb_history_idx = 0;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* found the callback history screen */
#if 0
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
#endif /* 0 */
{
/* is_del_cb_found = SearchDelScrnIDCallbackHandler(historyData[currHistoryIndex].scrnID, &cb_history_idx); */
if (!bBackHistoryFlag)
{
if (SearchDelScrnIDCallbackHandler(historyData[currHistoryIndex].scrnID, &cb_history_idx))
{
if (historyCBHandler[cb_history_idx].historydelCBPtr)
{
is_stop_delete = historyCBHandler[cb_history_idx].historydelCBPtr((void*)MMI_HIST_DELETE_SCREEN_TYPE);
if (is_stop_delete == MMI_HIST_STOP_DELETING)
{
return MMI_HIST_STOP_DELETING;
}
ClearDelScrnIDCallbackHandler(historyCBHandler[cb_history_idx].scrnID, NULL);
}
}
}
}
mmi_free_history_buffer(currHistoryIndex);
memset(&historyData[currHistoryIndex], 0, sizeof(historyNode));
if ((currHistoryIndex > MIN_HISTORY + 1) && (currHistoryIndex < MAX_HISTORY))
{
--currHistoryIndex;
}
else if ((currHistoryIndex == 1) && (bRoundOffFlag == 0))
{
currHistoryIndex = 0;
}
else if (currHistoryIndex == 0)
{
currHistoryIndex = -1;
bRoundOffFlag = 0;
}
else if (bRoundOffFlag)
{
currHistoryIndex = MAX_HISTORY - 1;
bRoundOffFlag = 0;
}
return is_stop_delete;
}
#ifdef OSL_MEMORY_DUMP
/*****************************************************************************
* FUNCTION
* AddHistoryReferenceMemoryRecord
* DESCRIPTION
* adds a history along with memory record
*
* This is used to add a history
* PARAMETERS
* addHistory [IN]
* fileName [IN]
* lineNumber [IN]
* RETURNS
* void
*****************************************************************************/
void AddHistoryReferenceMemoryRecord(history *addHistory, char *fileName, int lineNumber)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
S32 length = 0;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
#ifdef __MMI_UI_TAB_PANE__
if (disable_history_save)
{
return;
}
#endif /* __MMI_UI_TAB_PANE__ */
#ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
if (redraw_in_small_screen_proceduer())
{
small_history_node = 0;
return;
}
#endif /* __MMI_UI_SMALL_SCREEN_SUPPORT__ */
/* 1. Check for OK pressed or BACK pressed */
MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_HIST_ADD_HISTREFMEMREC_HDLR, (IsBackHistory != MMI_TRUE)));
if (IsBackHistory != MMI_TRUE)
{
increment();
/* 3. Store History to History Data Structure */
memset(&historyData[currHistoryIndex], 0, sizeof(historyNode));
historyData[currHistoryIndex].scrnID = addHistory->scrnID;
historyData[currHistoryIndex].entryFuncPtr = addHistory->entryFuncPtr;
#ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
historyData[currHistoryIndex].isSmallScreen = (U16) small_history_node;
#endif
length = pfnUnicodeStrlen((PS8) addHistory->inputBuffer);
MMI_ASSERT(length * ENCODING_LENGTH + ENCODING_LENGTH <= MAX_INPUT_BUFFER);
if (length)
{
historyData[currHistoryIndex].inputBuffer = OslMallocCHK(length * ENCODING_LENGTH + ENCODING_LENGTH, fileName, lineNumber);
pfnUnicodeStrcpy((PS8) historyData[currHistoryIndex].inputBuffer, (PS8) addHistory->inputBuffer);
}
historyData[currHistoryIndex].guiBuffer = OslMallocCHK(MAX_GUI_BUFFER, fileName, lineNumber);
memcpy(historyData[currHistoryIndex].guiBuffer, addHistory->guiBuffer, MAX_GUI_BUFFER);
}
#ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
small_history_node = 0;
#endif
IsBackHistory = MMI_FALSE;
}
#else /* OSL_MEMORY_DUMP */
/*****************************************************************************
* FUNCTION
* AddHistoryReference
* DESCRIPTION
* adds a history
*
* This is used to add a history
* PARAMETERS
* addHistory [IN]
* RETURNS
* void
*****************************************************************************/
void AddHistoryReference(history *addHistory)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
S32 length = 0;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
#ifdef __MMI_UI_TAB_PANE__
if (disable_history_save)
{
return;
}
#endif /* __MMI_UI_TAB_PANE__ */
#ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
if (redraw_in_small_screen_proceduer())
{
small_history_node = 0;
return;
}
#endif /* __MMI_UI_SMALL_SCREEN_SUPPORT__ */
/* 1. Check for OK pressed or BACK pressed */
MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_HIST_ADD_HISTREF_HDLR, (IsBackHistory != MMI_TRUE)));
if (IsBackHistory != MMI_TRUE)
{
increment();
/* 3. Store History to History Data Structure */
memset(&historyData[currHistoryIndex], 0, sizeof(historyNode));
historyData[currHistoryIndex].scrnID = addHistory->scrnID;
historyData[currHistoryIndex].entryFuncPtr = addHistory->entryFuncPtr;
#ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
historyData[currHistoryIndex].isSmallScreen = (U16) small_history_node;
#endif
length = pfnUnicodeStrlen((PS8) addHistory->inputBuffer);
MMI_ASSERT(length * ENCODING_LENGTH + ENCODING_LENGTH <= MAX_INPUT_BUFFER);
if (length)
{
historyData[currHistoryIndex].inputBuffer = OslMalloc(length * ENCODING_LENGTH + ENCODING_LENGTH);
pfnUnicodeStrcpy((PS8) historyData[currHistoryIndex].inputBuffer, (PS8) addHistory->inputBuffer);
}
historyData[currHistoryIndex].guiBuffer = OslMalloc(MAX_GUI_BUFFER);
memcpy(historyData[currHistoryIndex].guiBuffer, addHistory->guiBuffer, MAX_GUI_BUFFER);
}
#ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
small_history_node = 0;
#endif
IsBackHistory = MMI_FALSE;
}
#endif /* OSL_MEMORY_DUMP */
/*****************************************************************************
* FUNCTION
* AddNHistory_ext
* DESCRIPTION
* adds a history with user specified size
*
* This is used to add a history where user specifies the size
* PARAMETERS
* addHistory [IN]
* size [IN]
* RETURNS
* void
*****************************************************************************/
/* MTK Leo add 0511, to reduce stack size */
void AddNHistory_ext(history *addHistory, U16 size)
/* MTK Leo end 0511 */
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
#ifdef __MMI_UI_TAB_PANE__
if (disable_history_save)
{
return;
}
#endif /* __MMI_UI_TAB_PANE__ */
#ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
if (redraw_in_small_screen_proceduer())
{
small_history_node = 0;
return;
}
#endif /* __MMI_UI_SMALL_SCREEN_SUPPORT__ */
MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_HIST_ADD_NHIST_HDLR, size, (IsBackHistory != MMI_TRUE)));
/* 1. Check for OK pressed or BACK pressed */
if (IsBackHistory != MMI_TRUE)
{
increment();
/* 3. Store History to History Data Structure */
memset(&historyData[currHistoryIndex], 0, sizeof(historyNode));
historyData[currHistoryIndex].scrnID = addHistory->scrnID;
historyData[currHistoryIndex].entryFuncPtr = addHistory->entryFuncPtr;
/* PMT START MAUI_00157013_AND_MAUI_00157021 PATCH */
#ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
historyData[currHistoryIndex].isSmallScreen = (U16) small_history_node;
#endif
MMI_ASSERT(size + ENCODING_LENGTH + 2 <= MAX_INPUT_BUFFER);
historyData[currHistoryIndex].inputBuffer = OslMalloc(size + ENCODING_LENGTH + 2);
memcpy(historyData[currHistoryIndex].inputBuffer, &size, 2);
memcpy((PS8) (historyData[currHistoryIndex].inputBuffer + 2), (PS8) addHistory->inputBuffer, (U32) size);
historyData[currHistoryIndex].guiBuffer = OslMalloc(MAX_GUI_BUFFER);
memcpy(historyData[currHistoryIndex].guiBuffer, addHistory->guiBuffer, MAX_GUI_BUFFER);
}
#ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
small_history_node = 0;
#endif
IsBackHistory = MMI_FALSE;
}
/*****************************************************************************
* FUNCTION
* AddHistoryEx
* DESCRIPTION
* adds a history with
*
* The applications could assign the related function pointer
* and let the MMI framework to get history data
* PARAMETERS
* addHistory [IN]
* size [IN]
* RETURNS
* void
*****************************************************************************/
MMI_BOOL AddHistoryEx(
U16 scrnID, /* the screen id */
FuncPtr entryFuncPtr, /* the screenˇs entry function */
HistoryGetData getGuiFuncPtr, /* the function to get GUI data */
HistoryGetSize getInputBufSizeFuncPtr, /* the function to get input buffer size */
HistoryGetData getInputBufFuncPtr, /* the function to get input buffer */
MemAlloc mallocFuncPtr, /* the function to allocate memory */
MemFree mfreeFuncPtr) /* the function to free memory */
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
S16 inputBuf_size;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
#ifdef __MMI_UI_TAB_PANE__
if (disable_history_save)
{
return MMI_TRUE;
}
#endif /* __MMI_UI_TAB_PANE__ */
#ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
if (redraw_in_small_screen_proceduer())
{
small_history_node = 0;
return MMI_TRUE;
}
#endif /* __MMI_UI_SMALL_SCREEN_SUPPORT__ */
MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_HIST_ADD_HIST_EX_HDLR, (IsBackHistory != MMI_TRUE)));
/* Check for OK pressed or BACK pressed */
if (IsBackHistory != MMI_TRUE)
{
increment();
/* Store History to History Data Structure */
memset(&historyData[currHistoryIndex], 0, sizeof(historyNode));
historyData[currHistoryIndex].scrnID = scrnID;
historyData[currHistoryIndex].entryFuncPtr = entryFuncPtr;
#ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
historyData[currHistoryIndex].isSmallScreen = (U16) small_history_node;
#endif
MMI_ASSERT(getGuiFuncPtr);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -