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

📄 mainmenu.c

📁 ct952 source code use for Digital Frame Photo
💻 C
📖 第 1 页 / 共 4 页
字号:
                    __bMenuState = _DlgFlowTable[__bMAINMENUDlgIndex].bNewMenuState;                    MAINMENU_SubUIInitial();                }            }            else if (bReturn == DLG_ACTION_CHANGE_DLG)            {                __bMAINMENUDlgIndex = _DlgFlowTable[__bMAINMENUDlgIndex].bChangeDlgState;                MAINMENU_DlgInitial();            }        }           }    else    {        bMenuFlowTableEntry = _MAINMENU_GetMenuFlowTableEntry();        if (bMenuFlowTableEntry != MAINMENU_INVALID_MENU_FLOW_ENTRY)        {            if (_MenuFlowTable[bMenuFlowTableEntry].Menu_Proc_Func_Ptr != NULL)            {                bReturn = _MenuFlowTable[bMenuFlowTableEntry].Menu_Proc_Func_Ptr(bKey);                                if (bReturn == MENU_ACTION_EXIT)                {                    __bMenuState = _MAINMENU_GetNextMenuState();                    if (__bMenuState != MAINMENU_INVALID_MENU_STATE)                    {                                            bMenuFlowTableEntry = _MAINMENU_GetMenuFlowTableEntry();                        if (bMenuFlowTableEntry != MAINMENU_INVALID_MENU_FLOW_ENTRY)                        {                                                if (_MenuFlowTable[bMenuFlowTableEntry].Menu_Recover_Func_Ptr != NULL)                            {                                _MenuFlowTable[bMenuFlowTableEntry].Menu_Recover_Func_Ptr();                            }                        }                    }                }                else if (bReturn == MENU_ACTION_EXIT_ALL)                {                    MAINMENU_ExitAll(TRUE, FALSE);                    }            }        }    }    return MENU_ACTION_DONE;}//***************************************************************************//  Function    :   MAINMENU_Trigger//  Abstract    :   Each UI needs to offer the trigger function. The trigger function can process //              :   some function that will be updated continuously or need to cancel some action when time-out.//  Arguments   :   none.//  Return      :   none.//  Side Effect :   none.//  Notes       :   //***************************************************************************void MAINMENU_Trigger(void){    BYTE bMenuFlowTableEntry;    bMenuFlowTableEntry = _MAINMENU_GetMenuFlowTableEntry();    if (bMenuFlowTableEntry != MAINMENU_INVALID_MENU_FLOW_ENTRY)    {                if (_MenuFlowTable[bMenuFlowTableEntry].Menu_Trigger_Func_Ptr != NULL)        {            _MenuFlowTable[bMenuFlowTableEntry].Menu_Trigger_Func_Ptr();        }    }}#endif //SUPPORT_STB//***************************************************************************//  Function    :   MAINMENU_Recover//  Abstract    :   Each menu needs to offer the recovery function. When it is overwritten by screen saver, it will be recovered.//  Arguments   :   none.//  Return      :   none.//  Side Effect :   none.//  Notes       :   //***************************************************************************#ifdef SUPPORT_STBvoid MAINMENU_Recover(void){    BYTE bMenuFlowTableEntry;#ifndef CT950_STYLE    _MAINMENU_DrawAllUI();#else    if (__bChooseMedia == MEDIA_SELECT_STB)    {        _MAINMENU_DrawAllUI();    }    else    {        MM_CompleteJPGEffect(TRUE); //Complete JPEG effect to prevent slide show effect error.        if (__bMenuState == MS_MAIN_MENU)        {            _MAINMENU_DrawAllUI();        }        else        {            if (__bMenuState != MAINMENU_INVALID_MENU_STATE)            {                                    bMenuFlowTableEntry = _MAINMENU_GetMenuFlowTableEntry();                if (bMenuFlowTableEntry != MAINMENU_INVALID_MENU_FLOW_ENTRY)                {                                        if (_MenuFlowTable[bMenuFlowTableEntry].Menu_Recover_Func_Ptr != NULL)                    {                        _MenuFlowTable[bMenuFlowTableEntry].Menu_Recover_Func_Ptr();                    }                }            }        }            }#endif //CT950_STYLE}#elseBYTE MAINMENU_Recover(BYTE bRecoverRegion){    MM_CompleteJPGEffect(TRUE); //Complete JPEG effect to prevent slide show effect error.    #ifdef PRESTOP_BEFORE_SETUP_AND_PROGRAM         CC_ForceStop(CC_FORCE_STOP_FROM_SETUP);#endif    _MAINMENU_InitDVDMode();        BACKDOOR_ExitBackDoorControl();    _MAINMENU_DrawAllUI();    DVDSETUP_Initial(TRUE);    return TRUE;}#endif //SUPPORT_STB#ifdef SUPPORT_STBvoid _MAINMENU_DrawButton(BYTE bButtonIndex, BYTE bType, BUTTON *pButton){    PARM_RECT ButtonRect;            ButtonRect.bColor = MAINMENU_BUTTON_HEIGHT;    if (bType == MAINMENU_BUTTON_NORMAL)    {        switch (__SetupInfo.bUIStyle)        {        case MENU_SYS_PREFERENCE_UI_STYLE_2:            ButtonRect.bShadePtr = _bMAINMENUButtonNormalPalette2;            break;        case MENU_SYS_PREFERENCE_UI_STYLE_3:            ButtonRect.bShadePtr = _bMAINMENUButtonNormalPalette3;            break;        case MENU_SYS_PREFERENCE_UI_STYLE_4:            ButtonRect.bShadePtr = _bMAINMENUButtonNormalPalette4;            break;        case MENU_SYS_PREFERENCE_UI_STYLE_1:        default:            ButtonRect.bShadePtr = _bMAINMENUButtonNormalPalette1;            break;        }    }    else if (bType == MAINMENU_BUTTON_HIGHLIGHT)    {        switch (__SetupInfo.bUIStyle)        {        case MENU_SYS_PREFERENCE_UI_STYLE_2:            ButtonRect.bShadePtr = _bMAINMENUButtonHighlightPalette2;            break;        case MENU_SYS_PREFERENCE_UI_STYLE_3:            ButtonRect.bShadePtr = _bMAINMENUButtonHighlightPalette3;            break;        case MENU_SYS_PREFERENCE_UI_STYLE_4:            ButtonRect.bShadePtr = _bMAINMENUButtonHighlightPalette4;            break;        case MENU_SYS_PREFERENCE_UI_STYLE_1:        default:            ButtonRect.bShadePtr = _bMAINMENUButtonHighlightPalette1;            break;        }    }    else //disable    {        ButtonRect.bShadePtr = _bMAINMENUButtonDisablePalette;    }    ButtonRect.rect.wLeft = _MAINMENU_GetButtonStartX(pButton);    ButtonRect.rect.wTop = _MAINMENU_GetButtonStartY(bButtonIndex);    ButtonRect.rect.wRight = ButtonRect.rect.wLeft+_MAINMENU_GetMaxButtonStringWidth(pButton)+MAINMENU_BUTTON_STRING_DISTANCE_H*2-1;    ButtonRect.rect.wBottom = ButtonRect.rect.wTop+MAINMENU_BUTTON_HEIGHT-1;    GDI_FillRoundRect(0|GDI_SHADING_OPERATION, MAINMENU_BUTTON_ARC_VALUE, &ButtonRect);    _MAINMENU_DrawButtonString(bButtonIndex, pButton);}WORD _MAINMENU_GetMaxButtonStringWidth(BUTTON* pButton){    BYTE bButtonIndex;    WORD wStringWidth = 0;    WORD wMaxStringWidth = 0;    for (bButtonIndex = 0; bButtonIndex < MAINMENU_BUTTON_NUM; bButtonIndex++)    {        wStringWidth = GDI_GetStringWidth_909(pButton[bButtonIndex].pwButtonString);        if (wMaxStringWidth < wStringWidth)        {            wMaxStringWidth = wStringWidth;        }            }    return wMaxStringWidth;}void _MAINMENU_DrawButtonString(BYTE bButtonIndex, BUTTON *pButton){    PARM_DRAW_STRING ButtonStringAttr;        MAINMENU_UseColorKey(&ButtonStringAttr);    ButtonStringAttr.bTextColor = MAINMENU_PALETTE_ENTRY_BUTTON_STRING;        ButtonStringAttr.wX = _MAINMENU_GetButtonStartX(pButton)+((_MAINMENU_GetButtonWidth(pButton)-GDI_GetStringWidth_909(pButton[bButtonIndex].pwButtonString)) >> 1);    ButtonStringAttr.wY = _MAINMENU_GetButtonStartY(bButtonIndex)+((MAINMENU_BUTTON_HEIGHT-GDI_GetStringHeight(pButton[bButtonIndex].pwButtonString)) >> 1);            GDI_DrawString_909(0, &ButtonStringAttr, pButton[bButtonIndex].pwButtonString);}WORD _MAINMENU_GetButtonStartX(BUTTON *pButton){    return (MAINMENU_CONTENT_REGION_START_X+((MAINMENU_CONTENT_REGION_WIDTH-_MAINMENU_GetButtonWidth(pButton)) >> 1));}WORD _MAINMENU_GetButtonStartY(BYTE bButtonIndex){    WORD wButtonDistance;        wButtonDistance = (MAINMENU_CONTENT_REGION_HEIGHT-MAINMENU_BUTTON_BACKGROUND_DISTANCE_V*2-MAINMENU_BUTTON_HEIGHT*MAINMENU_BUTTON_NUM)/(MAINMENU_BUTTON_NUM-1);    return (MAINMENU_CONTENT_REGION_START_Y+MAINMENU_BUTTON_BACKGROUND_DISTANCE_V+bButtonIndex*MAINMENU_BUTTON_HEIGHT+bButtonIndex*wButtonDistance);}WORD _MAINMENU_GetButtonWidth(BUTTON *pButton){    return (_MAINMENU_GetMaxButtonStringWidth(pButton)+MAINMENU_BUTTON_STRING_DISTANCE_H*2);}void _MAINMENU_ProcessButton(void){    switch (_bMAINMENUCursorIndex)    {    case MAINMENU_BUTTON_DVD_SETUP:        __bMenuState = MS_DVD_SETUP;        break;    case MAINMENU_BUTTON_DVB_MENU:        __bMenuState = MS_DVB_MENU;        break;    case MAINMENU_BUTTON_SYSTEM_SETTING:        __bMenuState = MS_SYSTEM_SETTING;        break;    case MAINMENU_BUTTON_GAME:        __bMenuState = MS_GAME;        break;    case MAINMENU_BUTTON_EXIT:        MAINMENU_ExitAll(TRUE, FALSE);        return;    default:        return;    }    MAINMENU_SubUIInitial();}BYTE _MAINMENU_GetMenuFlowTableEntry(void){    BYTE bEntryIndex;    for (bEntryIndex = 0; bEntryIndex < (sizeof(_MenuFlowTable)/sizeof(MENU_FLOW)); bEntryIndex++)    {        if (_MenuFlowTable[bEntryIndex].MenuState == __bMenuState)        {            return bEntryIndex;        }    }    return MAINMENU_INVALID_MENU_FLOW_ENTRY;}BYTE _MAINMENU_GetNextMenuState(void){    BYTE bEntryIndex;    for (bEntryIndex = 0; bEntryIndex < (sizeof(_MenuStateTable)/sizeof(MENU_STATE)); bEntryIndex++)    {        if (_MenuStateTable[bEntryIndex].MenuCurrentState == __bMenuState)        {            return _MenuStateTable[bEntryIndex].MenuChangeToStateAfterExit;        }    }    return MAINMENU_INVALID_MENU_STATE;}void MAINMENU_SubUIInitial(void){    BYTE bMenuFlowTableEntry;    bMenuFlowTableEntry = _MAINMENU_GetMenuFlowTableEntry();    if (bMenuFlowTableEntry != MAINMENU_INVALID_MENU_FLOW_ENTRY)    {        if (_MenuFlowTable[bMenuFlowTableEntry].Menu_Init_Func_Ptr != NULL)        {            _MenuFlowTable[bMenuFlowTableEntry].Menu_Init_Func_Ptr();        }    }}void MAINMENU_DlgInitial(void){        if (_DlgFlowTable[__bMAINMENUDlgIndex].Dlg_Init_Func_Ptr != NULL)    {        _DlgFlowTable[__bMAINMENUDlgIndex].Dlg_Init_Func_Ptr(MAINMENU_PALETTE_ENTRY_CONTENT_REGION);    }    __bMenuState = MS_DLG;}//***************************************************************************//  Function    :   MAINMENU_Game_Menu_Initial//  Abstract    :   When the menu is pop-up at 1st time, this initial function will be called. //                  Each UI can do its control initialization and draw the UI here.//  Arguments   :   none.//  Return      :   nonw.//  Side Effect :   none.//  Notes       :   //***************************************************************************void MAINMENU_Game_Menu_Initial(void){    _bDMAINMENUGameMenu = TRUE;    _bMAINMENUGameCursorIndex = 0;    _MAINMENU_Game_Menu_DrawAllUI();}//***************************************************************************//  Function    :   MAINMENU_Game_Menu_Recover//  Abstract    :   Each menu needs to offer the recovery function. When it is overwritten by screen saver, it will be recovered.//  Arguments   :   none.//  Return      :   none.//  Side Effect :   none.//  Notes       :   //***************************************************************************void MAINMENU_Game_Menu_Recover(void){    _MAINMENU_Game_Menu_DrawAllUI();}void _MAINMENU_Game_Menu_DrawAllUI(void){    BYTE bButtonIndex;    MAINMENU_InitializeGDI(__SetupInfo.bUIStyle - MENU_SYS_PREFERENCE_UI_STYLE_BEGIN);        //Draw background	MAINMENU_DrawMainBackground();    //Draw the title    MAINMENU_DrawTitleString(aMENUMainMenu, aMENUGame, NULL);        //Draw the buttons.    for (bButtonIndex = 0; bButtonIndex < MAINMENU_GAME_BUTTON_NUM; bButtonIndex++)    {        if (bButtonIndex == _bMAINMENUGameCursorIndex)        {            _MAINMENU_DrawButton(bButtonIndex, MAINMENU_BUTTON_HIGHLIGHT, _bMAINMENUGameButton);        }        else        {            _MAINMENU_DrawButton(bButtonIndex, MAINMENU_BUTTON_NORMAL, _bMAINMENUGameButton);        }    }    MAINMENU_DrawSelectionHelp(FALSE, FALSE);

⌨️ 快捷键说明

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