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

📄 shortcuts.c

📁 MTK6226修改平台UI的文件介绍
💻 C
📖 第 1 页 / 共 5 页
字号:
 *  Highlight handler of change order
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void HighlightShctOptionChangeOrder(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

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


/*****************************************************************************
 * FUNCTION
 *  ShctExecSelectedShortcut
 * DESCRIPTION
 *  Execute correspoding function of selected shortcuts.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void ShctExecSelectedShortcut(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 i = 0, count = 0, j = 0;
    S32 cand_total = (S32) shct_max_list_cand;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    SetCurrentProfileAsActivatedProfile();

    while (count < g_shct_cntx.CurrSelShct + 1) /* search for nth enable shortcut item */
    {
        if (g_shct_cntx.SelShctList[i++].shortcut_state == ENABLE_STATE)
        {
            count++;
        }
    }

#ifdef __FLIGHT_MODE_SUPPORT__
    if (mmi_bootup_get_active_flight_mode() != 0)
    {
        for (j = 0; j < cand_total; j++)
        {
            if (gShctCandList[j].shortcuts == g_shct_cntx.SelShctList[i - 1].shortcuts && 
                gShctCandList[j].shortcut_state & SHCT_NEED_SIM > 0)
            {
                    EntryShctInvalidSIM();
                    return;
            }
        }
    }
#endif /* __FLIGHT_MODE_SUPPORT__ */

    if (mmi_bootup_is_sim_valid() == MMI_FALSE)
    {
        for (j = 0; j < cand_total; j++)
        {
            if (gShctCandList[j].shortcuts == g_shct_cntx.SelShctList[i - 1].shortcuts && 
                gShctCandList[j].shortcut_state & SHCT_NEED_SIM > 0)
            {
            #ifdef __MMI_WLAN_FEATURES__
                if (gShctCandList[j].shortcut_state & SHCT_NEED_PREFERRED_MODE_CHECK)
                {
                    if (mmi_netset_get_active_preferred_mode() == 0) // GSM only
                    {
                        EntryShctInvalidSIM();
                        return;
                    }
                    else
                    {
                        PRINT_INFORMATION(("Shct: allow to execute"));
                        break;
                    }
                }
                else
            #endif /* __MMI_WLAN_FEATURES__ */
                {
                    EntryShctInvalidSIM();
                    return;
                }
            }
        }
    }

    (*maxHiliteInfo[g_shct_cntx.SelShctList[i - 1].shortcuts].entryFuncPtr) ();
    g_shct_cntx.LSKFunc = get_softkey_function(KEY_EVENT_UP, MMI_LEFT_SOFTKEY);
    (*g_shct_cntx.LSKFunc) ();
}


/*****************************************************************************
 * FUNCTION
 *  EntryShctInvalidSIM
 * DESCRIPTION
 *  Display for invalid SIM while a shortcut is selected to execute
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void EntryShctInvalidSIM(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
#ifdef __FLIGHT_MODE_SUPPORT__
    if (mmi_bootup_get_active_flight_mode() != 0)
        DisplayPopup(
            (U8*) GetString(STR_MENU_FLIGHT_MODE),
            IMG_GLOBAL_ERROR,
            0,
            UI_POPUP_NOTIFYDURATION_TIME,
            (U8) WARNING_TONE);
    else
#endif /* __FLIGHT_MODE_SUPPORT__ */
        DisplayPopup(
            (U8*) GetString(STR_SIM_INSERTION_MSG),
            IMG_GLOBAL_ERROR,
            0,
            UI_POPUP_NOTIFYDURATION_TIME,
            (U8) WARNING_TONE);
}


/*****************************************************************************
 * FUNCTION
 *  EntryShctInMainMenu
 * DESCRIPTION
 *  Execute correspoding function of selected shortcuts.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void EntryShctInMainMenu(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 i;
    U8 *guiBuffer;

#ifdef __MMI_TOUCH_SCREEN__
    U16 ShortcutList[SHCT_MAX_LIST + 1];
    U16 ShortcutStateIcon[SHCT_MAX_LIST + 1];
#else /* __MMI_TOUCH_SCREEN__ */ 
    U16 ShortcutList[SHCT_MAX_LIST];
    U16 ShortcutStateIcon[SHCT_MAX_LIST];
#endif /* __MMI_TOUCH_SCREEN__ */ 

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    EntryNewScreen(SCR_ID_SHCT_MAIN_MENU, NULL, EntryShctInMainMenu, NULL);

    guiBuffer = GetCurrGuiBuffer(SCR_ID_SHCT_MAIN_MENU);

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

    /* Last Entry is always Calibration */
    if (maxHiliteInfo[MENU_SETTING_CALIBRATION].entryFuncPtr)
    {
        ShortcutList[i] = ShctGetStringID(MENU_SETTING_CALIBRATION);
        ShortcutStateIcon[i++] = CHECKBOX_ON_IMAGE_ID;
    }

    if (mmi_frm_test_menu_item_hide(EXTRA_SHORTCUTS_OPTION_EDIT_MENUID))
    {
        mmi_frm_unhide_menu_item(EXTRA_SHORTCUTS_OPTION_EDIT_MENUID);
        mmi_frm_unhide_menu_item(EXTRA_SHORTCUTS_OPTION_CHAGNE_ORDER_MENUID);
        mmi_frm_unhide_menu_item(EXTRA_SHORTCUTS_OPTION_DELETE_MENUID);
    }
#endif /* __MMI_TOUCH_SCREEN__ */ 

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

    if (i == 0)
    {
        g_shct_cntx.CurrOptionShct = SHR_OPTIONS_ADD;
        ShowCategory15Screen(
            MAIN_MENU_SHORTCUTS_TEXT,
            GetRootTitleIcon(EXTRA_SHORTCUTS_MENUID),
            STR_GLOBAL_ADD,
            0,
            STR_GLOBAL_BACK,
            IMG_GLOBAL_BACK,
            i,
            ShortcutList,
            (U16*) ShortcutStateIcon,
            LIST_MENU,
            0,
            guiBuffer);
        SetLeftSoftkeyFunction(EntryShctEditScreen, KEY_EVENT_UP);
        SetKeyHandler(EntryShctEditScreen, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
    }
    else
    {
        RegisterHighlightHandler(ShortcutsMenuIndex);
        ShowCategory15Screen(
            MAIN_MENU_SHORTCUTS_TEXT,
            GetRootTitleIcon(EXTRA_SHORTCUTS_MENUID),
            STR_GLOBAL_OPTIONS,
            IMG_GLOBAL_OPTIONS,
            STR_GLOBAL_BACK,
            IMG_GLOBAL_BACK,
            i,
            ShortcutList,
            (U16*) ShortcutStateIcon,
            LIST_MENU,
            0,
            guiBuffer);
        SetLeftSoftkeyFunction(EntryShctOptionScreen, KEY_EVENT_UP);
        SetKeyHandler(EntryShctOptionScreen, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
    }
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
}


/*****************************************************************************
 * FUNCTION
 *  ShortcutsMenuIndex
 * DESCRIPTION
 *  Execute correspoding function of selected shortcuts.
 * PARAMETERS
 *  index       [IN]        
 * RETURNS
 *  void
 *****************************************************************************/
void ShortcutsMenuIndex(S32 index)
{
#ifdef __MMI_TOUCH_SCREEN__
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (index == g_shct_cntx.NumSelShct)
    {
        mmi_frm_hide_menu_item(EXTRA_SHORTCUTS_OPTION_EDIT_MENUID);
        mmi_frm_hide_menu_item(EXTRA_SHORTCUTS_OPTION_CHAGNE_ORDER_MENUID);
        mmi_frm_hide_menu_item(EXTRA_SHORTCUTS_OPTION_DELETE_MENUID);
    }
    else if (g_shct_cntx.CurrSelShct == g_shct_cntx.NumSelShct)
    {
        mmi_frm_unhide_menu_item(EXTRA_SHORTCUTS_OPTION_EDIT_MENUID);
        mmi_frm_unhide_menu_item(EXTRA_SHORTCUTS_OPTION_CHAGNE_ORDER_MENUID);
        mmi_frm_unhide_menu_item(EXTRA_SHORTCUTS_OPTION_DELETE_MENUID);
    }
#endif /* __MMI_TOUCH_SCREEN__ */ 
    g_shct_cntx.CurrSelShct = (U8) index;
}


/*****************************************************************************
 * FUNCTION
 *  ShctResetOptions
 * DESCRIPTION
 *  Execute correspoding function of selected shortcuts.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void ShctResetOptions(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (mmi_frm_test_menu_item_hide(EXTRA_SHORTCUTS_OPTION_ENABLE_MENUID))
    {
        mmi_frm_unhide_menu_item(EXTRA_SHORTCUTS_OPTION_ENABLE_MENUID);
    }
    if (mmi_frm_test_menu_item_hide(EXTRA_SHORTCUTS_OPTION_DISABLE_MENUID))
    {
        mmi_frm_unhide_menu_item(EXTRA_SHORTCUTS_OPTION_DISABLE_MENUID);
    }
}


/*****************************************************************************
 * FUNCTION
 *  EntryShctOptionScreen
 * DESCRIPTION
 *  Entry the option screen of shortcuts
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void EntryShctOptionScreen(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U16 OptionShortcutsIds[6];
    U8 *guiBuffer;
    U16 MenuId;
    U16 nNumofItem; /* Stores no of children in the submenu */

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    EntryNewScreen(SCR_ID_SHCT_OPTION, NULL, EntryShctOptionScreen, NULL);

    guiBuffer = GetCurrGuiBuffer(SCR_ID_SHCT_OPTION);

    ShctResetOptions();

    if (g_shct_cntx.CurrOptionShct > SHR_OPTIONS_TOTAL)
    {
        g_shct_cntx.CurrOptionShct = 0;
    }

    MenuId = EXTRA_SHORTCUTS_OPTION_MENUID;

    if (g_shct_cntx.NumSelShct >= SHCT_MAX_LIST)
    {
        mmi_frm_hide_menu_item(EXTRA_SHORTCUTS_OPTION_ADD_MENUID);
    }

#ifdef __MMI_TOUCH_SCREEN__
    if (g_shct_cntx.CurrSelShct == g_shct_cntx.NumSelShct)
    {
        mmi_frm_hide_menu_item(EXTRA_SHORTCUTS_OPTION_ENABLE_MENUID);
        mmi_frm_hide_menu_item(EXTRA_SHORTCUTS_OPTION_DISABLE_MENUID);
    }
    else
#endif /* __MMI_TOUCH_SCREEN__ */ 
    if (g_shct_cntx.SelShctList[g_shct_cntx.CurrSelShct].shortcut_state == ENABLE_STATE)
    {
        mmi_frm_hide_menu_item(EXTRA_SHORTCUTS_OPTION_ENABLE_MENUID);
    }
    else
    {
        mmi_frm_hide_menu_item(EXTRA_SHORTCUTS_OPTION_DISABLE_MENUID);
    }

    nNumofItem = GetNumOfChild_Ext(MenuId);

    GetSequenceStringIds_Ext(MenuId, OptionShortcutsIds);

    SetParentHandler(MenuId);

    RegisterHighlightHandler(ExecuteCurrHiliteHandler_Ext);

    ShowCategory15Screen(
        STR_GLOBAL_OPTIONS,
        GetRootTitleIcon(EXTRA_SHORTCUTS_MENUID),
        STR_GLOBAL_OK,
        IMG_GLOBAL_OK,
        STR_GLOBAL_BACK,
        IMG_GLOBAL_BACK,
        nNumofItem,

⌨️ 快捷键说明

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