⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 shortcuts.c

📁 MTK6226修改平台UI的文件介绍
💻 C
📖 第 1 页 / 共 5 页
字号:
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S32 i;
    S32 count = (S32) shct_max_list_cand;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    g_shct_cntx.NumCandShct = 0;

    for (i = 0; i < count; i++)
        if (maxHiliteInfo[gShctCandList[i].shortcuts].entryFuncPtr)
        {
            g_shct_cntx.CandShctList[g_shct_cntx.NumCandShct++] = gShctCandList[i].shortcuts;
        }
}


/*****************************************************************************
 * FUNCTION
 *  ShctReadFromNvram
 * DESCRIPTION
 *  Read shortcut data from NVRAM and initialize selected shortcut list.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void ShctReadFromNvram(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S8 j, total, index = 0;

    U8 nvramData[SHCT_NVRAM_SIZE];
    shct_item_struct menuID;
    S16 error;
    S8 shortcut_not_found = FALSE;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    ReadRecord(NVRAM_EF_SHORTCUTS_LID, 1, (void*)nvramData, SHCT_NVRAM_SIZE, &error);

    if (nvramData[1] != 1)
    {
        nvramData[SHCT_COUNT_BYTE] = shct_list_default;
        nvramData[SHCT_INTEGRITY_BYTE] = 1;
        memcpy(
            (void*)&nvramData[SHCT_DATA_BYTE],
            (void*)&gShctDefaultList,
            sizeof(shct_item_struct) * shct_list_default);
        WriteRecord(NVRAM_EF_SHORTCUTS_LID, 1, (void*)nvramData, SHCT_NVRAM_SIZE, &error);
    }

    total = nvramData[SHCT_COUNT_BYTE];
    g_shct_cntx.Integrity = nvramData[SHCT_INTEGRITY_BYTE];

    for (j = 0; j < total; j++)
    {
        memcpy(&menuID, &nvramData[j * sizeof(shct_item_struct) + SHCT_DATA_BYTE], sizeof(shct_item_struct));
        if (maxHiliteInfo[menuID.shortcuts].entryFuncPtr)
        {
            g_shct_cntx.SelShctList[index++] = menuID;
            error = menuID.shortcuts;
        }
        else
        {
            shortcut_not_found = TRUE;
            MMI_TRACE((MMI_TRACE_G1_FRM, MMI_SHORTCUTS_NOT_FOUND, menuID.shortcuts));
            break;
        }
    }
#ifdef MMI_ON_HARDWARE_P
    MMI_ASSERT(shortcut_not_found == FALSE);
#endif 
    g_shct_cntx.NumSelShct = index;
}


/*****************************************************************************
 * FUNCTION
 *  ShctMenuShortcut
 * DESCRIPTION
 *  Shortcut handler of selected menu item
 * PARAMETERS
 *  index       [IN]        
 *  a(?)        [IN]        Index of menu item
 * RETURNS
 *  void
 *****************************************************************************/
void ShctMenuShortcut(S32 index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (index >= 0 && index < g_shct_cntx.NumSelShct)
    {
        execute_left_softkey_function(KEY_EVENT_UP);
    }
}


/*****************************************************************************
 * FUNCTION
 *  EntryShctInIdle
 * DESCRIPTION
 *  Display shorcut list in IDLE screen.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void EntryShctInIdle(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 i, index = 0;
    U8 *guiBuffer;

    /* U8 num=0; */

    // #if 0
#ifdef __MMI_TOUCH_SCREEN__
    U16 ShortcutList[SHCT_MAX_LIST + 1];
#else 
    U16 ShortcutList[SHCT_MAX_LIST];
#endif 

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    // #endif

    for (i = 0; i < g_shct_cntx.NumSelShct; i++)
    {
        if (g_shct_cntx.SelShctList[i].shortcut_state == ENABLE_STATE)
        {
            ShortcutList[index++] = ShctGetStringID(g_shct_cntx.SelShctList[i].shortcuts);
        }
    }
#ifdef __MMI_TOUCH_SCREEN__

    /* Last Entry is always Calibration */
    if (maxHiliteInfo[MENU_SETTING_CALIBRATION].entryFuncPtr)
    {
        g_shct_cntx.SelShctList[i].shortcuts = MENU_SETTING_CALIBRATION;
        g_shct_cntx.SelShctList[i].shortcut_state = ENABLE_STATE;
        ShortcutList[index++] = ShctGetStringID(MENU_SETTING_CALIBRATION);
    }
#endif /* __MMI_TOUCH_SCREEN__ */ 
    EntryNewScreen(SCR_ID_SHCT_IDLE_SHORTCUT, NULL, EntryShctInIdle, NULL);

    if (g_shct_cntx.CurrSelShct > g_shct_cntx.NumSelShct - 1)
    {
        g_shct_cntx.CurrSelShct = 0;
    }

    guiBuffer = GetCurrGuiBuffer(SCR_ID_SHCT_IDLE_SHORTCUT);

    RegisterHighlightHandler(HighlightShctSelShortcut);

    if (index > 0)
    {
        ShowCategory15Screen(
            SHORTCUTS_TITLE_STRING_ID,
            GetRootTitleIcon(EXTRA_SHORTCUTS_MENUID),
            STR_GLOBAL_OK,
            IMG_GLOBAL_OK,
            STR_GLOBAL_BACK,
            IMG_GLOBAL_BACK,
            index,
            ShortcutList,
            (U16*) gIndexIconsImageList,
            LIST_MENU,
            0,
            guiBuffer);
        SetLeftSoftkeyFunction(ShctExecSelectedShortcut, KEY_EVENT_UP);
        SetKeyHandler(ShctExecSelectedShortcut, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
        register_menu_shortcut_selected(ShctMenuShortcut);
    }
    else
    {
        ShowCategory15Screen(
            SHORTCUTS_TITLE_STRING_ID,
            GetRootTitleIcon(EXTRA_SHORTCUTS_MENUID),
            0,
            0,
            STR_GLOBAL_BACK,
            IMG_GLOBAL_BACK,
            index,
            ShortcutList,
            (U16*) gIndexIconsImageList,
            LIST_MENU,
            0,
            guiBuffer);
    }
    CHISTResetCallLogIndex();
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

}


/*****************************************************************************
 * FUNCTION
 *  HighlightShctSelShortcut
 * DESCRIPTION
 *  Highlight handler for IDLE screen shortcut.
 * PARAMETERS
 *  index       [IN]        
 * RETURNS
 *  void
 *****************************************************************************/
void HighlightShctSelShortcut(S32 index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    g_shct_cntx.CurrSelShct = (U8) index;
    /*
     * ChangeLeftSoftkey(STR_GLOBAL_OK,IMG_GLOBAL_OK);
     * SetLeftSoftkeyFunction(ShctExecSelectedShortcut,KEY_EVENT_UP);
     * SetKeyHandler(ShctExecSelectedShortcut,KEY_RIGHT_ARROW,KEY_EVENT_DOWN);
     * 
     * ChangeRightSoftkey(STR_GLOBAL_BACK,IMG_GLOBAL_BACK);
     * SetRightSoftkeyFunction(GoBackHistory,KEY_EVENT_UP);
     * SetKeyHandler(GoBackHistory,KEY_LEFT_ARROW,KEY_EVENT_DOWN);
     */
}


/*****************************************************************************
 * FUNCTION
 *  HighlightShctOptionAdd
 * DESCRIPTION
 *  Highlight handler of add option
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void HighlightShctOptionAdd(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    g_shct_cntx.CurrOptionShct = SHR_OPTIONS_ADD;
    SetKeyHandler(ShctSelOption, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
}


/*****************************************************************************
 * FUNCTION
 *  HighlightShctOptionEdit
 * DESCRIPTION
 *  Highlight handler of edit option
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void HighlightShctOptionEdit(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    g_shct_cntx.CurrOptionShct = SHR_OPTIONS_EDIT;
    SetKeyHandler(ShctSelOption, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
}


/*****************************************************************************
 * FUNCTION
 *  HighlightShctOptionDelete
 * DESCRIPTION
 *  Highlight handler of delete option
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void HighlightShctOptionDelete(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    g_shct_cntx.CurrOptionShct = SHR_OPTIONS_DELETE;
    SetKeyHandler(NULL, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
}


/*****************************************************************************
 * FUNCTION
 *  HighlightShctOptionDeleteAll
 * DESCRIPTION
 *  Highlight handler of delete all option
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void HighlightShctOptionDeleteAll(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    g_shct_cntx.CurrOptionShct = SHR_OPTIONS_DELETE_ALL;
    SetKeyHandler(NULL, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
}


/*****************************************************************************
 * FUNCTION
 *  HighlightShctOptionEnable
 * DESCRIPTION
 *  Highlight handler of delete all option
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void HighlightShctOptionEnable(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    g_shct_cntx.CurrOptionShct = SHR_OPTIONS_ENABLE;
    SetKeyHandler(NULL, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
}


/*****************************************************************************
 * FUNCTION
 *  HighlightShctOptionDisable
 * DESCRIPTION
 *  Highlight handler of delete all option
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void HighlightShctOptionDisable(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    g_shct_cntx.CurrOptionShct = SHR_OPTIONS_DISABLE;
    SetKeyHandler(NULL, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
}


/*****************************************************************************
 * FUNCTION
 *  HighlightShctOptionChangeOrder
 * DESCRIPTION

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -