📄 osd3.c
字号:
void OSDMENU_MenuOperation(BYTE bKey){ BYTE bItemNum, bOrgItem; BYTE bMenuOperation=0; // Brian1.08a // Brian1.08a, transfer Key to menu operation#ifdef SUPPORT_SETUP_HORIZONTAL_ICON_MENU // Horizontal icon menu if (__bMENUCurrentLevel == 0) { // at root (icon) menu switch (bKey) { case KEY_UP: return; case KEY_DOWN: bMenuOperation = OSDMENU_GOTO_SUB_MENU; break; case KEY_RIGHT: bMenuOperation = OSDMENU_GOTO_NEXT_ITEM; break; case KEY_LEFT: bMenuOperation = OSDMENU_GOTO_PREV_ITEM; break; case KEY_ENTER: case KEY_PLAY: case KEY_PLAY_PAUSE: bMenuOperation = OSDMENU_SELECT_ITEM; break; } } else // it is not root menu { // none root (icon) menu switch (bKey) { case KEY_UP: // need to check when it's the topest item // it's more convenient to do the check when processing the operation, // for the condition code is already there bMenuOperation = OSDMENU_GOTO_PREV_ITEM; break; case KEY_DOWN: bMenuOperation = OSDMENU_GOTO_NEXT_ITEM; break; case KEY_RIGHT: bMenuOperation = OSDMENU_GOTO_SUB_MENU; break; case KEY_STOP: // allow use KEY_STOP to go to parent menu case KEY_LEFT: // need chech when it's the left most item // it's more convenient to do the check when processing the operation, // for the condition code is already there bMenuOperation = OSDMENU_GOTO_PARENT_MENU; break; case KEY_ENTER: case KEY_PLAY: case KEY_PLAY_PAUSE: bMenuOperation = OSDMENU_SELECT_ITEM; break; } }#else // Vertical icno menu // just 1-to-1 mapping switch (bKey) { case KEY_UP: bMenuOperation = OSDMENU_GOTO_PREV_ITEM; break; case KEY_DOWN: bMenuOperation = OSDMENU_GOTO_NEXT_ITEM; break; case KEY_RIGHT: bMenuOperation = OSDMENU_GOTO_SUB_MENU; break; case KEY_LEFT: bMenuOperation = OSDMENU_GOTO_PARENT_MENU; break; case KEY_ENTER: case KEY_PLAY: case KEY_PLAY_PAUSE: bMenuOperation = OSDMENU_SELECT_ITEM; break; } #endif // SUPPORT_SETUP_HORIZONTAL_ICON_MENUprocess_key_op: _pTempMenu = _pMenuIndex[__bCurrentMenuId]; bItemNum = GET_MENU_ITEM_NUM(_pTempMenu); // Brian1.08a switch (bMenuOperation) { // Brian1.08a case OSDMENU_GOTO_PREV_ITEM: // Brian1.08a, support Horizontal icon menu#ifdef SUPPORT_SETUP_HORIZONTAL_ICON_MENU if (__bMENUSelect[__bMENUCurrentLevel] == 0) { if (__bMENUCurrentLevel == 1) // menu level 2 ==> value menu, don't go to paranet menu { // it is the topest item, so need to move to icon menu bMenuOperation = OSDMENU_GOTO_PARENT_MENU; goto process_key_op; } } else#else if (__bMENUSelect[__bMENUCurrentLevel] != 0)#endif { #ifdef SKIP_DISABLED_ITEM // Brian1.05, don't move cursor onto disabled item. bOrgItem = __bMENUSelect[__bMENUCurrentLevel]; // keep the current select while(__bMENUSelect[__bMENUCurrentLevel] != 0) { __bMENUSelect[__bMENUCurrentLevel]--; _bMENUTemp = __bMENUSelect[__bMENUCurrentLevel]; if(GET_ITEM_ATTRIBUTE(_pTempMenu, _bMENUTemp) == IS_ITEM || GET_ITEM_ATTRIBUTE(_pTempMenu, _bMENUTemp) == IS_DIALOG) { if (*(GET_MENU_ENABLE(_pTempMenu)+_bMENUTemp/8) & (1 << (_bMENUTemp%8))) // if enabled { break; // find a enabled item } else { if (__bMENUSelect[__bMENUCurrentLevel] == 0) { // no enabled item is found, so the cursor remain still __bMENUSelect[__bMENUCurrentLevel] = bOrgItem;// Brian1.08a, support Horizontal icon menu#ifdef SUPPORT_SETUP_HORIZONTAL_ICON_MENU // since there is no Up items, so go to Icon menu bMenuOperation = OSDMENU_GOTO_PARENT_MENU; goto process_key_op; #else return;#endif } } } // if IS_ITEM else { break; // for value, no such consideration, just move the cursor as usual } } // while#else // allow move to disabled item __bMENUSelect[__bMENUCurrentLevel]--;#endif if (__bMENUCurrentLevel < MENU_LEVEL-1) __bMENUSelect[__bMENUCurrentLevel+1] = 0; // set select to 0, the first item. __wMENUPrevItemId = __wMENUCurrentItemId; if (__bMENUCurrentLevel == 0) { OSDSETUP_ShowDescriptionText(); // Brian1.08a, display menu settings when menu cursor in on Icon menu #ifdef SUPPORT_MENU_SETTINGS_DISPLAY _ClearCurrentSettings(); _DisplayCurrentSettings();#endif } if(GET_ITEM_ATTRIBUTE(_pTempMenu, __bMENUSelect[__bMENUCurrentLevel]) == IS_LINE) { // I assume nobody will put a seperate line as the first item, // so I don't check if it is out of the range __bMENUSelect[__bMENUCurrentLevel]--; bItemNum = 1; // just use it to keep if this is a seperate line } else bItemNum = 0; // just use it to keep if this is a seperate line if (__bMENUSelect[__bMENUCurrentLevel] < __bMENUDisplayStart[__bMENUCurrentLevel]) {#ifdef SKIP_DISABLED_ITEM __bMENUDisplayStart[__bMENUCurrentLevel] = __bMENUSelect[__bMENUCurrentLevel] -bItemNum;#else __bMENUDisplayStart[__bMENUCurrentLevel] -= (1+bItemNum);#endif OSDMENU_DisplayMenu(__bCurrentMenuId, 0xFF, __bMENUCurrentLevel); } else {#ifdef SKIP_DISABLED_ITEM // Brian1.05, don't move cursor onto disabled item. // alan090 _MENU_StrAttr.bTextColor = OSDMENU_ENTRY_TEXT_COLOR_NORMAL; OSDMENU_DrawItem(__bMENUDisplayStart[__bMENUCurrentLevel], (BYTE)(bOrgItem+bItemNum), (BYTE)OSDMENU_ENTRY_ITEM_COLOR_NORMAL);#else OSDMENU_DrawItem(__bMENUDisplayStart[__bMENUCurrentLevel], (BYTE)(__bMENUSelect[__bMENUCurrentLevel]+1+bItemNum), (BYTE)OSDMENU_ENTRY_ITEM_COLOR_NORMAL);#endif } __wMENUCurrentItemId = GET_ITEM_ID(_pTempMenu, __bMENUSelect[__bMENUCurrentLevel]); // clear the previous menu#ifdef SKIP_DISABLED_ITEM _pTempMenu = GET_SUB_MENU(_pTempMenu, bOrgItem+bItemNum);#else _pTempMenu = GET_SUB_MENU(_pTempMenu, __bMENUSelect[__bMENUCurrentLevel]+1+bItemNum);#endif if (_pTempMenu) { OSDMENU_ClearMenu(); __bMENUStatus[__bMENUCurrentLevel+1] &= 0xFE; // clear scroll-up bit __bMENUStatus[__bMENUCurrentLevel+1] &= 0xFD; // clear scroll-down bit } _pTempMenu = _pMenuIndex[__bCurrentMenuId]; _bMENUTemp = __bMENUSelect[__bMENUCurrentLevel]; if(GET_ITEM_ATTRIBUTE(_pTempMenu, _bMENUTemp) == IS_ITEM) { if (*(GET_MENU_ENABLE(_pTempMenu)+_bMENUTemp/8) & (1 << (_bMENUTemp%8))) { // item is enabled, set the text color as normal color _MENU_StrAttr.bTextColor = OSDMENU_ENTRY_TEXT_COLOR_NORMAL; OSDMENU_DrawItem(__bMENUDisplayStart[__bMENUCurrentLevel], __bMENUSelect[__bMENUCurrentLevel], OSDMENU_ENTRY_ITEM_COLOR_HIGHLIGHT); OSDMENU_DisplaySubMenu(__bMENUSelect[__bMENUCurrentLevel], __bMENUCurrentLevel); } else { // item is disabled, set the text color as disable color _MENU_StrAttr.bTextColor = OSDMENU_ENTRY_TEXT_COLOR_DISABLE; OSDMENU_DrawItem(__bMENUDisplayStart[__bMENUCurrentLevel], __bMENUSelect[__bMENUCurrentLevel], OSDMENU_ENTRY_ITEM_COLOR_HIGHLIGHT); } break; } // Brian1.02a,for Dialog like "Parental", "Change Password" else if(GET_ITEM_ATTRIBUTE(_pTempMenu, _bMENUTemp) == IS_DIALOG) { if (*(GET_MENU_ENABLE(_pTempMenu)+_bMENUTemp/8) & (1 << (_bMENUTemp%8))) { // item is enabled, set the text color as normal color _MENU_StrAttr.bTextColor = OSDMENU_ENTRY_TEXT_COLOR_NORMAL; } else { // item is disabled, set the text color as disable color _MENU_StrAttr.bTextColor = OSDMENU_ENTRY_TEXT_COLOR_DISABLE; } } OSDMENU_DrawItem(__bMENUDisplayStart[__bMENUCurrentLevel], __bMENUSelect[__bMENUCurrentLevel], OSDMENU_ENTRY_ITEM_COLOR_HIGHLIGHT); OSDMENU_DisplaySubMenu(__bMENUSelect[__bMENUCurrentLevel], __bMENUCurrentLevel); } break; // Brian1.08a case OSDMENU_GOTO_NEXT_ITEM: if (__bMENUSelect[__bMENUCurrentLevel] != bItemNum-1) {#ifdef SKIP_DISABLED_ITEM // Brian1.05, don't move cursor onto disabled item. bOrgItem = __bMENUSelect[__bMENUCurrentLevel]; // keep the current select while(__bMENUSelect[__bMENUCurrentLevel] != bItemNum-1) { __bMENUSelect[__bMENUCurrentLevel]++; _bMENUTemp = __bMENUSelect[__bMENUCurrentLevel]; if(GET_ITEM_ATTRIBUTE(_pTempMenu, _bMENUTemp) == IS_ITEM|| GET_ITEM_ATTRIBUTE(_pTempMenu, _bMENUTemp) == IS_DIALOG) { if (*(GET_MENU_ENABLE(_pTempMenu)+_bMENUTemp/8) & (1 << (_bMENUTemp%8))) // if enabled { break; // find a enabled item } else { if (__bMENUSelect[__bMENUCurrentLevel] == bItemNum-1) { // no enabled item is found, so the cursor remain still __bMENUSelect[__bMENUCurrentLevel] = bOrgItem; return; } } } // if IS_ITEM else { break; // for value, no such consideration, just move the cursor as usual } } // while#else __bMENUSelect[__bMENUCurrentLevel]++;#endif if (__bMENUCurrentLevel < MENU_LEVEL-1) __bMENUSelect[__bMENUCurrentLevel+1] = 0; // set select to 0, the first item. __wMENUPrevItemId = __wMENUCurrentItemId; if (__bMENUCurrentLevel == 0) { OSDSETUP_ShowDescriptionText(); // Brian1.08a, display menu settings when menu cursor in on Icon menu #ifdef SUPPORT_MENU_SETTINGS_DISPLAY _ClearCurrentSettings(); _DisplayCurrentSettings();#endif } if(GET_ITEM_ATTRIBUTE(_pTempMenu, __bMENUSelect[__bMENUCurrentLevel]) == IS_LINE) { // I assume nobody will put a seperate line as the last item, // so I don't check if it is out of the range __bMENUSelect[__bMENUCurrentLevel]++;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -