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

📄 shortcuts.c

📁 MTK6226修改平台UI的文件介绍
💻 C
📖 第 1 页 / 共 5 页
字号:
        OptionShortcutsIds,
        (U16*) gIndexIconsImageList,
        LIST_MENU,
        0,
        guiBuffer);

    SetLeftSoftkeyFunction(ShctSelOption, KEY_EVENT_UP);

    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

}


/*****************************************************************************
 * FUNCTION
 *  EntryShctEditScreen
 * DESCRIPTION
 *  Execute correspoding function of selected shortcuts.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void EntryShctEditScreen(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 i;
    U8 highlighted = 0;
    U16 EditShortcutsIds[SHCT_MAX_CANDI_LIST];
    U8 *guiBuffer;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    EntryNewScreen(SCR_ID_SHCT_EDIT, NULL, EntryShctEditScreen, NULL);

    guiBuffer = GetCurrGuiBuffer(SCR_ID_SHCT_EDIT);

    for (i = 0; i < g_shct_cntx.NumCandShct; i++)
    {
        EditShortcutsIds[i] = ShctGetStringID(g_shct_cntx.CandShctList[i]);

        if (g_shct_cntx.CurrOptionShct == SHR_OPTIONS_EDIT)
        {
            if (guiBuffer == NULL)
                if (g_shct_cntx.CandShctList[i] == g_shct_cntx.SelShctList[g_shct_cntx.CurrSelShct].shortcuts)
                {
                    highlighted = i;
                }
        }
    }

    RegisterHighlightHandler(HighlightShctEdit);
    ShowCategory1Screen(
        MAIN_MENU_SHORTCUTS_TEXT,
        GetRootTitleIcon(EXTRA_SHORTCUTS_MENUID),
        STR_GLOBAL_OK,
        IMG_GLOBAL_OK,
        STR_GLOBAL_BACK,
        IMG_GLOBAL_BACK,
        g_shct_cntx.NumCandShct,
        EditShortcutsIds,
        highlighted,
        guiBuffer);

    switch (g_shct_cntx.CurrOptionShct)
    {
        case SHR_OPTIONS_EDIT:
            g_shct_cntx.Order = g_shct_cntx.CurrSelShct + 1;
            SetLeftSoftkeyFunction(ShctSaveChanges, KEY_EVENT_UP);
            break;
        case SHR_OPTIONS_ADD:
            SetLeftSoftkeyFunction(ShctSetOrder, KEY_EVENT_UP);
            break;
        default:
            break;
    }
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
}


/*****************************************************************************
 * FUNCTION
 *  EntryShctDeleteScreen
 * DESCRIPTION
 *  Display confirmation screen for deleting one shortcut item.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void EntryShctDeleteScreen(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    switch (g_shct_cntx.CurrOptionShct)
    {
        case SHR_OPTIONS_DELETE_ALL:
            DisplayConfirm(
                STR_GLOBAL_YES,
                IMG_GLOBAL_YES,
                STR_GLOBAL_NO,
                IMG_GLOBAL_NO,
                get_string(STR_GLOBAL_DELETE_ALL),
                IMG_GLOBAL_QUESTION,
                WARNING_TONE);
            break;
        default:
            DisplayConfirm(
                STR_GLOBAL_YES,
                IMG_GLOBAL_YES,
                STR_GLOBAL_NO,
                IMG_GLOBAL_NO,
                get_string(STR_GLOBAL_DELETE),
                IMG_GLOBAL_QUESTION,
                WARNING_TONE);
            break;
    }

    SetLeftSoftkeyFunction(ShctDeleteItem, KEY_EVENT_UP);
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
}


/*****************************************************************************
 * FUNCTION
 *  ShctDeleteItem
 * DESCRIPTION
 *  Display confirmation screen for deleting one shortcut item.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void ShctDeleteItem(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (g_shct_cntx.Integrity == 1)
    {
        switch (g_shct_cntx.CurrOptionShct)
        {
            case SHR_OPTIONS_DELETE:
                memcpy(
                    &g_shct_cntx.SelShctList[g_shct_cntx.CurrSelShct],
                    &g_shct_cntx.SelShctList[g_shct_cntx.CurrSelShct + 1],
                    (g_shct_cntx.NumSelShct - g_shct_cntx.CurrSelShct - 1) * sizeof(shct_item_struct));
                g_shct_cntx.NumSelShct--;
                break;
            case SHR_OPTIONS_DELETE_ALL:
                g_shct_cntx.NumSelShct = 0;
                break;
        }
        ShctWriteToNvram();

        if (g_shct_cntx.NumSelShct < SHCT_MAX_LIST)
        {
            mmi_frm_unhide_menu_item(EXTRA_SHORTCUTS_OPTION_ADD_MENUID);
        }

        ShctShowPopupScreen(STR_GLOBAL_DONE);
    }
    else
    {
        DisplayPopup(
            (U8*) GetString(STR_GLOBAL_UNFINISHED),
            IMG_GLOBAL_UNFINISHED,
            0,
            UI_POPUP_NOTIFYDURATION_TIME,
            (U8) ERROR_TONE);
    }

}


/*****************************************************************************
 * FUNCTION
 *  ShctGetStringID
 * DESCRIPTION
 *  Return the string ID of a menu item.
 * PARAMETERS
 *  menu_id     [IN]        Index of a menu item.
 * RETURNS
 *  string index
 *****************************************************************************/
U16 ShctGetStringID(U16 menu_id)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    return nCustMenus[menu_id - 1].nStrId;
}


/*****************************************************************************
 * FUNCTION
 *  HighlightShctEdit
 * DESCRIPTION
 *  Highlight handler for edit shortcut screen
 * PARAMETERS
 *  index           [IN]        
 *  menu_id(?)      [IN]        Index of a menu item.
 * RETURNS
 *  string index(?)
 *****************************************************************************/
void HighlightShctEdit(S32 index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    g_shct_cntx.CurrEditShct = (U8) index;
}


/*****************************************************************************
 * FUNCTION
 *  ATSetShortcuts
 * DESCRIPTION
 *  Set shortcutfrom AT command
 * PARAMETERS
 *  index       [?]         
 *  inde(?)     [IN]        List of shortcut index
 * RETURNS
 *  string index
 *****************************************************************************/
BOOL ATSetShortcuts(U8 *index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 i;
    U8 ID;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (index == NULL)
    {
        return MMI_FALSE;
    }

    for (i = 0; i < SHCT_MAX_LIST; i++)
    {
        ID = index[i] - 1;
        if (ID < g_shct_cntx.NumCandShct)
        {
            g_shct_cntx.SelShctList[i].shortcuts = g_shct_cntx.CandShctList[ID];
        }
    }

    ShctWriteToNvram();

    return MMI_TRUE;
}


/*****************************************************************************
 * FUNCTION
 *  ShctSelOption
 * DESCRIPTION
 *  select option of shortcut item
 * PARAMETERS
 *  void
 *  index(?)        [IN]        List of shortcut index
 * RETURNS
 *  string index(?)
 *****************************************************************************/
void ShctSelOption(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    switch (g_shct_cntx.CurrOptionShct)
    {
        case SHR_OPTIONS_EDIT:
            EntryShctEditScreen();
            break;

        case SHR_OPTIONS_ADD:
            if (g_shct_cntx.NumSelShct < SHCT_MAX_LIST)
            {
                EntryShctEditScreen();
            }
            else
            {
                ShctShowPopupScreen(SHORTCUTS_FULL_MSG_STRING_ID);
            }
            break;

        case SHR_OPTIONS_DELETE:
        case SHR_OPTIONS_DELETE_ALL:
            EntryShctDeleteScreen();
            break;

        case SHR_OPTIONS_ENABLE:
            ShctChangeState((U8) ENABLE_STATE);
            break;
        case SHR_OPTIONS_DISABLE:
            ShctChangeState((U8) DISABLE_STATE);
            break;
        case SHR_OPTIONS_CHANGE_ORDER:
            ShctSetOrder();
            break;
        default:
            break;
    }
}


/*****************************************************************************
 * FUNCTION
 *  ShctChangeState
 * DESCRIPTION
 *  Display confirmation screen for changing the state of the shortcut item.
 * PARAMETERS
 *  state       [IN]        
 * RETURNS
 *  void
 *****************************************************************************/
void ShctChangeState(U8 state)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (g_shct_cntx.Integrity == 1)
    {
        g_shct_cntx.SelShctList[g_shct_cntx.CurrSelShct].shortcut_state = state;

        ShctWriteToNvram();
        ShctShowPopupScreen(STR_GLOBAL_DONE);
    }
    else
    {
        DisplayPopup(
            (U8*) GetString(STR_GLOBAL_UNFINISHED),
            IMG_GLOBAL_UNFINISHED,
            0,
            UI_POPUP_NOTIFYDURATION_TIME,
            (U8) ERROR_TONE);
    }

}


/*****************************************************************************
 * FUNCTION
 *  ShctSetOrder
 * DESCRIPTION
 *  Set the shortcuts order
 * PARAMETERS
 *  void
 *  index(?)        [IN]        List of shortcut index
 * RETURNS
 *  string index(?)
 *****************************************************************************/
void ShctSetOrder(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    PU8 guiBuffer;

⌨️ 快捷键说明

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