📄 unitconvertor.c
字号:
/*****************************************************************************
* FUNCTION
* EntryUConvCompute
* DESCRIPTION
* Entry function of conterting screen
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void EntryUConvCompute(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U8 *guiBuffer;
U8 *inputBuffer; /* added for inline edit history */
U16 inputBufferSize; /* added for inline edit history */
U16 ScrID = (SCR_ID_UCONV_WEIGHT + g_uconv_cntx->CurrHiliteUnitType);
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
EntryNewScreen(ScrID, ExitUConvCompute, NULL, NULL);
SetDelScrnIDCallbackHandler(ScrID, (HistoryDelCBPtr) mmi_uconv_del_scr_callback);
set_leading_zero(FALSE);
guiBuffer = GetCurrGuiBuffer(ScrID);
InitializeCategory57Screen();
UConvFillInlineStruct();
RegisterHighlightHandler(HighlightUConvInlineItem);
inputBuffer = GetCurrNInputBuffer(ScrID, &inputBufferSize); /* added for inline edit history */
if (inputBuffer) /* added for inline edit history */
{
SetCategory57Data(wgui_inline_items, UCONV_INLINE_TOTAL, inputBuffer); /* sets the data */
}
DisableCategory57ScreenDone();
ShowCategory57Screen(
STR_UNITCONVERTOR_CAPTION1,
GetRootTitleIcon(EXTRA_UNITCONVERTOR_MENU),
STR_GLOBAL_OK,
IMG_GLOBAL_OK,
STR_GLOBAL_BACK,
IMG_GLOBAL_BACK,
UCONV_INLINE_TOTAL,
NULL,
wgui_inline_items,
g_uconv_cntx->CurrSelectedItem,
guiBuffer);
if (g_uconv_cntx->CurrHiliteUnitType == UCONV_WEIGHT)
{
SetCategory57RightSoftkeyFunctions(ComputeWeightResult, GoBackHistory);
}
else
{
SetCategory57RightSoftkeyFunctions(ComputeLengthResult, GoBackHistory);
}
}
/*****************************************************************************
* FUNCTION
* HighlightUConvInlineItem
* DESCRIPTION
* Highlight handler of inline items
* PARAMETERS
* index [IN]
* RETURNS
* void
*****************************************************************************/
void HighlightUConvInlineItem(S32 index)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (index == 0) /* inline selection */
{
ChangeLeftSoftkey(STRING_ID_NULL, IMAGE_ID_NULL);
ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
}
else
{
#ifdef __MMI_CONVERTER_KEEP_INLINE_FOCUS__
if ((U8) index != g_uconv_cntx->CurrSelectedItem)
{
memset(g_uconv_cntx->MetricBuf, 0, 2);
memset(g_uconv_cntx->EngBuf, 0, 2);
}
/* if re-entry screen because of displaying result */
else if(!g_uconv_cntx->ClearResultFlag && *(g_uconv_cntx->EngBuf) != 0 && *(g_uconv_cntx->MetricBuf) != 0)
{
g_uconv_cntx->ClearResultFlag = TRUE;
}
ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
if (g_uconv_cntx->CurrHiliteUnitType == UCONV_WEIGHT)
{
SetLeftSoftkeyFunction(ComputeWeightResult, KEY_EVENT_UP);
}
else
{
SetLeftSoftkeyFunction(ComputeLengthResult, KEY_EVENT_UP);
}
#else /* __MMI_CONVERTER_KEEP_INLINE_FOCUS__ */
if (index != g_uconv_cntx->CurrSelectedItem)
{
memset(g_uconv_cntx->MetricBuf, 0, 2);
memset(g_uconv_cntx->EngBuf, 0, 2);
}
ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
if (g_uconv_cntx->CurrHiliteUnitType == UCONV_WEIGHT)
{
SetLeftSoftkeyFunction(ComputeWeightResult, KEY_EVENT_UP);
}
else
{
SetLeftSoftkeyFunction(ComputeLengthResult, KEY_EVENT_UP);
}
#endif /* __MMI_CONVERTER_KEEP_INLINE_FOCUS__ */
}
g_uconv_cntx->CurrSelectedItem = (U8) index;
return;
}
/*****************************************************************************
* FUNCTION
* HighlightUConvInlineWeightSelect
* DESCRIPTION
* Highlight handler inline selection item in Weight convertor.
* Redraw caption according to select.
* PARAMETERS
* index [IN]
* RETURNS
* void
*****************************************************************************/
void HighlightUConvInlineWeightSelect(S32 index)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
UI_character_type *Caption1, *Caption2;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
g_uconv_cntx->CurrInlineSelectUnit = (U8) index;
Caption1 = (UI_character_type*) (GetString(STR_UNITCONVERTOR_KG));
if (index == 0) /* Kg <-> Pound */
{
Caption2 = (UI_character_type*) (GetString(STR_UNITCONVERTOR_POUND));
}
else
{
Caption2 = (UI_character_type*) (GetString(STR_UCONV_OUNCE));
}
memset(g_uconv_cntx->MetricBuf, 0, 2);
memset(g_uconv_cntx->EngBuf, 0, 2);
Category57ChangeItemText(1, (U8*) Caption1);
Category57ChangeItemText(3, (U8*) Caption2);
RedrawCategoryFunction();
}
/*****************************************************************************
* FUNCTION
* HighlightUConvInlineLenghSelect
* DESCRIPTION
* Highlight handler inline selection item in Length convertor.
* Redraw caption according to select.
* PARAMETERS
* index [IN]
* RETURNS
* void
*****************************************************************************/
void HighlightUConvInlineLenghSelect(S32 index)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
UI_character_type *Caption1, *Caption2;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
g_uconv_cntx->CurrInlineSelectUnit = index;
Caption2 = (UI_character_type*) (GetString((U16) (STR_UNITCONVERTOR_MILE + g_uconv_cntx->CurrInlineSelectUnit)));
switch (g_uconv_cntx->CurrInlineSelectUnit)
{
case 0:
Caption1 = (UI_character_type*) (GetString(STR_UNITCONVERTOR_KM));
break;
case 3:
Caption1 = (UI_character_type*) (GetString(STR_UNITCONVERTOR_CM));
break;
default:
Caption1 = (UI_character_type*) (GetString(STR_UNITCONVERTOR_METER));
break;
}
memset(g_uconv_cntx->MetricBuf, 0, 2);
memset(g_uconv_cntx->EngBuf, 0, 2);
Category57ChangeItemText(1, (U8*) Caption1);
Category57ChangeItemText(3, (U8*) Caption2);
RedrawCategoryFunction();
}
#else /* __MMI_UNIT_CONVERTER__ */ /* else of ifdef __MMI_UNIT_CONVERTER__ */
/*****************************************************************************
* FUNCTION
* mmi_uconv_highlight_volume
* DESCRIPTION
* Highlight handler of Volume menu in Unit Convertor
* Register key handlers.
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void mmi_uconv_highlight_volume(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
g_uconv_cntx->CurrHiliteUnitType = UCONV_VOLUME;
SetLeftSoftkeyFunction(mmi_uconv_goto_compute_screen_lg, KEY_EVENT_UP);
SetKeyHandler(mmi_uconv_goto_compute_screen_lg, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
}
/*****************************************************************************
* FUNCTION
* mmi_uconv_highlight_temperature
* DESCRIPTION
* Highlight handler of Temperature menu in Unit Convertor
* Register key handlers.
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void mmi_uconv_highlight_temperature(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
g_uconv_cntx->CurrHiliteUnitType = UCONV_TEMPERATURE;
SetLeftSoftkeyFunction(mmi_uconv_goto_compute_screen_lg, KEY_EVENT_UP);
SetKeyHandler(mmi_uconv_goto_compute_screen_lg, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
}
/*****************************************************************************
* FUNCTION
* mmi_uconv_highlight_velocity
* DESCRIPTION
* Highlight handler of Velocity menu in Unit Convertor
* Register key handlers.
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void mmi_uconv_highlight_velocity(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
g_uconv_cntx->CurrHiliteUnitType = UCONV_VELOCITY;
SetLeftSoftkeyFunction(mmi_uconv_goto_compute_screen_lg, KEY_EVENT_UP);
SetKeyHandler(mmi_uconv_goto_compute_screen_lg, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
}
/*****************************************************************************
* FUNCTION
* mmi_uconv_highlight_length
* DESCRIPTION
* Highlight handler of Length menu in Unit Convertor
* Register key handlers.
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void mmi_uconv_highlight_length(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
g_uconv_cntx->CurrHiliteUnitType = UCONV_LENGTH;
SetLeftSoftkeyFunction(mmi_uconv_goto_compute_screen_lg, KEY_EVENT_UP);
SetKeyHandler(mmi_uconv_goto_compute_screen_lg, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -