📄 mainmenu.~c
字号:
#define MAINMENU_MAIN_FILE#define MAINMENU_MAIN_FILE_STRING#include "winav.h"#ifdef SUPPORT_STB#include "dvbcustm.h"#endif //#ifdef SUPPORT_STB#include "cell.h"#include "utl.h"#include "comutl.h"#include "gdi.h"#include "osd.h"#include "fontindex.h"#include "infofilter.h"#include "osddsply.h"#include "osdnd.h"#include "input.h"#ifdef SUPPORT_STB#include "dvb_func.h"#include "sysmenu.h"#include "dvbmenu.h"#include "ap_flow.h"#include "ui.h"#endif //SUPPORT_STB#include "toolbar.h"#include "menu.h"#include "dvdsetup.h"#include "mainmenu.h"#include "cc.h"#include "media.h"#include "navigate.h"#include "dvdsetup_op.h"#include "hdecoder.h"#include "hal.h"#include "mmanager.h"#include "osd.h"#include "disp.h"#include "chips.h"#include "thumb.h"#ifdef SUPPORT_STB#include "..\\..\\OSDString\\strextrn.h"#else#include "OSDString\\strextrn.h"#endif //SUPPORT_STB#ifdef SUPPORT_POWERON_MENU#include "poweronmenu.h"#endif //SUPPORT_POWERON_MENU#define PLAY_AFTER_EXIT_SETUPBYTE _bMAINMENUMode = FALSE;#ifdef SUPPORT_STBBYTE __bMenuState;BYTE __bMAINMENUDlgIndex;BYTE _bDMAINMENUGameMenu = FALSE;BYTE _bMAINMENUCursorIndex;//For Game menu usageBYTE _bMAINMENUGameCursorIndex;#endif //SUPPORT_STBWORD aMENUTitleSeparation[] = {1, CHAR_HYPHEN_MINUS};WORD aMENUHelpIconLeft[] = {1, CHAR_LEFT};WORD aMENUHelpIconRight[] = {1, CHAR_RIGHT};WORD aMENUHelpIconUp[] = {1, CHAR_UP};WORD aMENUHelpIconDown[] = {1, CHAR_DOWN};#ifdef SUPPORT_N_PLAY_AS_ENTER_FLAGWORD aMENUHelpIconConfirm[] = {7,CHAR_LESS_THAN_SIGN, CHAR_E,CHAR_n,CHAR_t,CHAR_e,CHAR_r,CHAR_GREATER_THAN_SIGN};#elseWORD aMENUHelpIconConfirm[] = {1, CHAR_N_PLAY};#endif#ifdef SUPPORT_STBextern BYTE __bEPGScheduleMode;#endif //SUPPORT_STBextern BYTE __bOSDPromptMode;extern BYTE BackDoor_ProcessKey(BYTE bKey);extern void BACKDOOR_ExitBackDoorControl(void);//*********************************************************************************************************// Function : MAIN_MENU_ProcessKey// Abstract : Call this function to process the keys.// Arguments : none.// Return : KEY_NO_KEY: The input key is processed.// : INVALID_KEY: The input key is not allowed.// : KEY_xxx: The main program need do more process for the key.// Side Effect : none.// Notes : //*********************************************************************************************************BYTE MAIN_MENU_ProcessKey(void){ if ((_bMAINMENUMode == FALSE) && (__bKey != KEY_SETUP)) //for DVD { return KEY_BYPASS; } #ifndef SUPPORT_STB __bKey = BackDoor_ProcessKey(__bKey); #endif //SUPPORT_STB if ((__bKey == KEY_POWER) || (__bKey == KEY_OPEN_CLOSE)) { _bMAINMENUMode = FALSE; MAINMENU_ExitAll(TRUE, FALSE);#ifdef SUPPORT_STB DVB_FUNC_Schedule_term();#endif //SUPPORT_STB return KEY_BYPASS; }#ifdef SUPPORT_STB if ((!_bMAINMENUMode) && (__bKey == KEY_SETUP)) {#ifdef SUPPORT_POWERON_MENU if (_bDMAINMENUGameMenu) { return KEY_NO_KEY; }#endif //SUPPORT_POWERON_MENU __bSetupMode = TRUE; //Let DVD flow think it's in SETUP mode. MAINMENU_Initial(); } else { MAINMENU_ProcessKey(__bKey); }#else if ((!_bMAINMENUMode) && (__bKey == KEY_SETUP)) {#ifdef SUPPORT_COPY_FILE_IN_SLIDE_SHOW if (__bMMSlideShowCopyDeleteMode != MM_SLIDE_SHOW_NORMAL_MODE) { return KEY_NO_KEY; }#endif //SUPPORT_COPY_FILE_IN_SLIDE_SHOW __bSetupMode = TRUE; //Let DVD flow think it's in SETUP mode. _bMAINMENUMode = TRUE; MAINMENU_Initial(); DVDSETUP_Initial(FALSE); } else { if (__bKey == KEY_SETUP) { MAINMENU_ExitAll(TRUE, FALSE); } if (__bKey == KEY_PLAY_PAUSE) { __bKey = KEY_ENTER; } DVDSETUP_ProcessKey(__bKey); }#endif //#ifdef SUPPORT_STB return KEY_NO_KEY;}//***************************************************************************// Function : MAINMENU_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_Initial(void){#ifdef SUPPORT_STB //Initialize the variables. _bMAINMENUMode = TRUE; __bMenuState = MS_MAIN_MENU; if (__bChooseMedia == MEDIA_SELECT_STB) { _bMAINMENUCursorIndex = MAINMENU_BUTTON_DVB_MENU; } else { MM_CompleteJPGEffect(TRUE); //Complete JPEG effect to prevent slide show effect error. OSD_ChangeUI(OSD_UI_MAIN_MENU, OSD_ENTER_UI); _bMAINMENUCursorIndex = MAINMENU_BUTTON_DVD_SETUP; _MAINMENU_InitDVDMode(); }#else 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 //OSD_ChangeUI(OSD_UI_MAIN_MENU, OSD_ENTER_UI); OSD_ChangeUI(OSD_UI_SETUP, OSD_ENTER_UI); //CoCo2.38 _MAINMENU_InitDVDMode(); #endif //SUPPORT_STB _MAINMENU_DrawAllUI();}#ifdef SUPPORT_STBBYTE _MAINMENU_MoveCursorUp(void){ BYTE bMAINMENUCursorIndex; bMAINMENUCursorIndex = _bMAINMENUCursorIndex; bMAINMENUCursorIndex--; if (((__bChooseMedia != MEDIA_SELECT_STB) && (bMAINMENUCursorIndex == MAINMENU_BUTTON_DVB_MENU)) || ((__bChooseMedia == MEDIA_SELECT_STB) && (bMAINMENUCursorIndex == MAINMENU_BUTTON_DVD_SETUP))) { if (bMAINMENUCursorIndex != 0) { bMAINMENUCursorIndex--; } else { bMAINMENUCursorIndex = _bMAINMENUCursorIndex; } } return bMAINMENUCursorIndex;}BYTE _MAINMENU_MoveCursorDown(void){ BYTE bMAINMENUCursorIndex; bMAINMENUCursorIndex = _bMAINMENUCursorIndex; bMAINMENUCursorIndex++; if (((__bChooseMedia != MEDIA_SELECT_STB) && (bMAINMENUCursorIndex == MAINMENU_BUTTON_DVB_MENU)) || ((__bChooseMedia == MEDIA_SELECT_STB) && (bMAINMENUCursorIndex == MAINMENU_BUTTON_DVD_SETUP))) { if (bMAINMENUCursorIndex != (MAINMENU_BUTTON_NUM-1)) { bMAINMENUCursorIndex++; } else { bMAINMENUCursorIndex = _bMAINMENUCursorIndex; } } return bMAINMENUCursorIndex;}void _MAINMENU_UpdateButton(BYTE bNewCursor){ if (bNewCursor != _bMAINMENUCursorIndex) { _MAINMENU_DrawButton(_bMAINMENUCursorIndex, MAINMENU_BUTTON_NORMAL, _bMAINMENUButton); _bMAINMENUCursorIndex = bNewCursor; _MAINMENU_DrawButton(_bMAINMENUCursorIndex, MAINMENU_BUTTON_HIGHLIGHT, _bMAINMENUButton); }}//***************************************************************************// Function : MAINMENU_ProcessKey// Abstract : When the menu is active, IR key will be sent to this menu's processing key function.// Arguments : none.// Return : MENU_ACTION_DONE: The key has been processed OK. If the key is invalid, it will be skipped by this function.// MENU_ACTION_EXIT: The menu (sub-UI) exists.// Side Effect : none.// Notes : //***************************************************************************BYTE MAINMENU_ProcessKey(BYTE bKey){ BYTE bReturn; BYTE bMenuFlowTableEntry; BYTE bCursorIndex; if (bKey == KEY_NO_KEY) { return MENU_ACTION_DONE; } if (!_bMAINMENUMode) { if (bKey == KEY_SETUP) { _bMAINMENUMode = TRUE; MAINMENU_Initial(); } return MENU_ACTION_DONE; } //CoCo, don't let sub-UIs enter the back door. if (__bMenuState == MS_MAIN_MENU) { bKey = BackDoor_ProcessKey(bKey); } //This judgement need to put after "back door" if ((bKey == KEY_SETUP) || ((__bChooseMedia == MEDIA_SELECT_STB) && (bKey == KEY_MENU))) //DVD can't use KEY_MENU to enter main menu. { MAINMENU_ExitAll(TRUE, FALSE); return MENU_ACTION_DONE; } if (__bMenuState == MS_MAIN_MENU) { if (bKey == KEY_EXIT) { MAINMENU_ExitAll(TRUE, FALSE); return MENU_ACTION_DONE; } switch (bKey) { case KEY_UP: if (_bMAINMENUCursorIndex != 0) { bCursorIndex = _MAINMENU_MoveCursorUp(); _MAINMENU_UpdateButton(bCursorIndex); } break; case KEY_DOWN: if (_bMAINMENUCursorIndex != (MAINMENU_BUTTON_NUM-1)) { bCursorIndex = _MAINMENU_MoveCursorDown(); _MAINMENU_UpdateButton(bCursorIndex); } break; case KEY_PLAY: case KEY_ENTER: _MAINMENU_ProcessButton(); break; } } else if (__bMenuState == MS_DLG) { if (_DlgFlowTable[__bMAINMENUDlgIndex].Dlg_Proc_Func_Ptr != NULL) { bReturn = _DlgFlowTable[__bMAINMENUDlgIndex].Dlg_Proc_Func_Ptr(bKey); if (bReturn == DLG_ACTION_EXIT_RECOVER_NENU) { __bMenuState = _DlgFlowTable[__bMAINMENUDlgIndex].bRecoverMenuState; 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 == DLG_ACTION_EXIT_NEW_NENU) { if (_DlgFlowTable[__bMAINMENUDlgIndex].bNewMenuState == MAINMENU_INVALID_MENU_STATE) { __bMenuState = _DlgFlowTable[__bMAINMENUDlgIndex].bRecoverMenuState; 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 { __bMenuState = _DlgFlowTable[__bMAINMENUDlgIndex].bNewMenuState; MAINMENU_SubUIInitial(); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -