📄 osddlg.c
字号:
//**********************************************************************// Function : OSDCOMDLG_SetRect // Abstract : This function sets the dialog size // Arguments : wLeft : left point// wTop : top point // wRight: right point // wBottom: bottom point // Return : none.// Side Effect : none.// Notes : //**********************************************************************void OSDCOMDLG_SetRect(WORD wLeft, WORD wTop, WORD wRight, WORD wBottom){ _DLG_FrameAttr.bStyle = FRAME_POP_SOLID; _DLG_FrameAttr.bThickness = FRAME_THICKNESS; _DLG_FrameAttr.bColorBright = OSDCOMDLG_ENTRY_FRAME_BRIGHT; _DLG_FrameAttr.bColorDark = OSDCOMDLG_ENTRY_FRAME_DARK; _DLG_FrameAttr.bColorCenter = OSDCOMDLG_ENTRY_FRAME_CENTER; _DLG_FrameAttr.rect.wLeft = wLeft; _DLG_FrameAttr.rect.wRight = wRight; _DLG_FrameAttr.rect.wTop = wTop; _DLG_FrameAttr.rect.wBottom = wBottom; _DLG_RectAttr.bColor = PAL_ENTRY_COLOR_TRANSPARENT; _DLG_RectAttr.rect.wLeft = wLeft; _DLG_RectAttr.rect.wRight = wRight; _DLG_RectAttr.rect.wTop = wTop; _DLG_RectAttr.rect.wBottom = wBottom; }//**********************************************************************// Function : OSDCOMDLG_SetButtonNum // Abstract : This function sets the dialog size // Arguments : nButtonNum : set the button number. It must be less than 3 // Return : TRUE : Set successfully. FALSE : Fail to set// Side Effect : none.// Notes : //**********************************************************************BOOL OSDCOMDLG_SetButtonNum(BYTE nButtonNum){ if (2 < nButtonNum) return FALSE; _bButtonNum = nButtonNum; return TRUE;}//**********************************************************************// Function : OSDCOMDLG_SetMessage // Abstract : This function sets the strings to be display// Arguments : pwString : The pointer to the string// Return : none.// Side Effect : none.// Notes : //**********************************************************************void OSDCOMDLG_SetMessage(WORD* pwString){ _pwString = pwString;}//**********************************************************************// Function : OSDCOMDLG_Select_OK_YES_Button // Abstract : Select the "OK" or "Yes" button// Arguments : none.// Return : none.// Side Effect : none.// Notes : //**********************************************************************void OSDCOMDLG_Select_OK_YES_Button(void){ _bSelectButton = BUTTON_OK_YES; _OSDCOMDLG_ClearButtonsArea(); _OSDCOMDLG_HighlightButton(BUTTON_OK_YES); _OSDCOMDLG_DrawButtons();}//**********************************************************************// Function : OSDCOMDLG_Select_Cancel_NO_Button // Abstract : Select the "Cancel" or "No" button// Arguments : none.// Return : none.// Side Effect : none.// Notes : //**********************************************************************void OSDCOMDLG_Select_Cancel_NO_Button(void){ if (1 == _bButtonNum) return; _bSelectButton = BUTTON_CANCEL_NO; _OSDCOMDLG_ClearButtonsArea(); _OSDCOMDLG_HighlightButton(BUTTON_CANCEL_NO); _OSDCOMDLG_DrawButtons();}//**********************************************************************// Function : OSDCOMDLG_DrawString // Abstract : After the dialog is drawn, call this function to draw the// the string at the specified position// Arguments : wX, wY : the position// pwString : The pointer to the string// Return : none.// Side Effect : none.// Notes : //**********************************************************************void OSDCOMDLG_DrawString(WORD wX, WORD wY, WORD *pwString){ _DLG_StrAttr.wX = _DLG_FrameAttr.rect.wLeft + wX; _DLG_StrAttr.wY = _DLG_FrameAttr.rect.wTop + wY; _DLG_StrAttr.bTextColor = OSDCOMDLG_ENTRY_STRING; _DLG_StrAttr.bBackground = _DLG_FrameAttr.bColorCenter; //GDI_DrawString_909(0, &_DLG_StrAttr, pwString); _OSDDLG_DrawDynamicString(pwString);}//**********************************************************************// Function : OSDCOMDLG_DrawDialog // Abstract : Draw the dialog// Arguments : none.// Return : TRUE: Success.// FALSE: Fail// Side Effect : none.// Notes : //**********************************************************************BOOL OSDCOMDLG_DrawDialog(void){ if (TRUE == _bDialogShowUp) return FALSE; if (!__bSetupMode) OSD_ChangeUI(OSD_UI_COMMON_DLG, OSD_ENTER_UI); _OSDCOMDLG_InitPalette(); _DLG_RectAttr.bColor = PAL_ENTRY_COLOR_TRANSPARENT; GDI_FillRect_909(0, &_DLG_RectAttr); GDI_DrawFrame_909(0, &_DLG_FrameAttr); if (NULL != _pwString) { _OSDCOMDLG_DrawStringWithAutoWrap(OSDCOMDLG_MARGIN_H, OSDCOMDLG_MARGIN_V, _pwString); } _OSDCOMDLG_DrawButtons(); _bDialogShowUp = TRUE; _dwLastTime = OS_GetSysTimer(); return TRUE;}//**********************************************************************// Function : OSDCOMDLG_ProcessKey// Abstract : Process Key// Arguments : none.// Return : KEY_INVALID, KEY_TODO, KEY_BYPASS, KEY_NO_KEY.// Side Effect : none.// Notes : //**********************************************************************//BYTE OSDCOMDLG_ProcessKey(BYTE bKey)BYTE OSDCOMDLG_ProcessKey(){ BYTE bKeyStatus; if (FALSE == _bDialogShowUp) return KEY_BYPASS; switch (__bKey) //Alan085, for common dialog { case KEY_UP: case KEY_RIGHT: OSDCOMDLG_Select_Cancel_NO_Button(); bKeyStatus = KEY_NO_KEY; break; case KEY_DOWN: case KEY_LEFT: OSDCOMDLG_Select_OK_YES_Button(); bKeyStatus = KEY_NO_KEY; break; case KEY_ACTIVE: case KEY_ENTER: case KEY_PLAY: case KEY_PLAY_PAUSE: // LLY1.07, forget to process play & pause key. if (__bSetupMode) OSDCOMDLG_Exit(OSD_UI_EXIT_CONTROL_ONLY); else OSDCOMDLG_Exit(OSD_UI_EXIT_ALL); bKeyStatus = KEY_TODO; if (_pCallbackFunc) bKeyStatus = (_pCallbackFunc)(); else bKeyStatus = KEY_TODO; break; case KEY_POWER: case KEY_OPEN_CLOSE: OSDCOMDLG_Exit(OSD_UI_EXIT_ALL); bKeyStatus = KEY_BYPASS; break; default: bKeyStatus = KEY_NO_KEY;// If return KEY_INVALID, the top part of Setup UI will be cut // bKeyStatus = KEY_INVALID; } return bKeyStatus;}//**********************************************************************// Function : OSDCOMDLG_Get_Select_Button// Abstract : Query which button is selected // Arguments : none.// Return : none.// Side Effect : none.// Notes : //**********************************************************************BYTE OSDCOMDLG_Get_Select_Button(void){ return _bSelectButton;}//**********************************************************************// Function : OSDCOMDLG_Set_WaitingTime// Abstract : Set the time to count down// Arguments : bSecond : how many second to count down// Return : none.// Side Effect : none.// Notes ://**********************************************************************void OSDCOMDLG_Set_WaitingTime(BYTE bSecond){ _bWaitingTime = bSecond;}//**********************************************************************// Function : OSDCOMDLG_Register_TimeoutFunc // Abstract : Set the callback function when the time is out // Arguments : pTimeoutFunc : callback function// Return : none.// Side Effect : none.// Notes : //**********************************************************************void OSDCOMDLG_Register_TimeoutFunc(TIMEOUT_FUNC pTimeoutFunc){ _pTimeoutFunc = pTimeoutFunc;}//**********************************************************************// Function : OSDCOMDLG_Register_CallbackFunc // Abstract : Set the callback function when button is pressed // Arguments : pCallbackFunc : callback function// Return : none.// Side Effect : none.// Notes : //**********************************************************************void OSDCOMDLG_Register_CallbackFunc(CALLBACK_FUNC pCallbackFunc){ _pCallbackFunc = pCallbackFunc;}//**********************************************************************// Function : OSDCOMDLG_Register_RecoverFunc // Abstract : Set the recover function when the dialog is recovered // Arguments : pRecoverFunc : callback function// Return : none.// Side Effect : none.// Notes : //**********************************************************************void OSDCOMDLG_Register_RecoverFunc(RECOVER_FUNC pRecoverFunc){ _pRecoverFunc = pRecoverFunc;}//**********************************************************************// Function : OSDCOMDLG_Exit // Abstract : Clear the dialog// Arguments : OSD_UI_EXIT_ALL : UI is clear// OSD_UI_EXIT_CONTROL_ONLY : UI is not clear.// Return : none.// Side Effect : none.// Notes : //**********************************************************************void OSDCOMDLG_Exit(BYTE bExitMode){ switch (bExitMode) { case OSD_UI_EXIT_ALL: _OSDCOMDLG_ClearUI(); break; case OSD_UI_EXIT_CONTROL_ONLY: default: break; } _bDialogShowUp = FALSE; _pTimeoutFunc = NULL; _pwString = NULL;}//**********************************************************************// Function : OSDCOMDLG_Recover // Abstract : Recover the dialog// Arguments : bRecoverRegion// Return : none.// Side Effect : none.// Notes : //**********************************************************************BYTE OSDCOMDLG_Recover(BYTE bRecoverRegion){ if (OSD_RECOVER_ALL != bRecoverRegion) return FALSE; _OSDCOMDLG_InitPalette(); GDI_FillRect_909(0, &_DLG_RectAttr); GDI_DrawFrame_909(0, &_DLG_FrameAttr); if (NULL != _pwString) { _OSDCOMDLG_DrawStringWithAutoWrap(OSDCOMDLG_MARGIN_H, OSDCOMDLG_MARGIN_V, _pwString); } _OSDCOMDLG_DrawButtons();/* OSDCOMDLG_Exit(OSD_UI_EXIT_CONTROL_ONLY); OSD_ChangeUI(OSD_UI_COMMON_DLG, OSD_EXIT_UI); if (_pRecoverFunc) (_pRecoverFunc)(); */ return TRUE;}//**********************************************************************// Function : OSDCOMDLG_ConfigOSDRegion// Abstract : Set the OSD region// Arguments : none.// Return : none.// Side Effect : none.// Notes : //**********************************************************************void OSDCOMDLG_ConfigOSDRegion(void){ GDI_REGION_INFO RegionInfo;#ifdef BORROW_FRAME_BUFFER DWORD dwBufferAddr;#endif // if (!__bSetupMode) { RegionInfo.bColorMode = GDI_OSD_8B_MODE;#ifdef ENLARGE_OSD_FOR_PAL_MODE RegionInfo.wWidth = GDI_REGION_WIDTH; if ((__bTVType == SETUP_SCREEN_TV_SYSTEM_NTSC) || (__bTVType == SETUP_SCREEN_TV_SYSTEM_PAL_M)) { RegionInfo.wHeight = GDI_REGION_HEIGHT; } else { RegionInfo.wHeight = GDI_REGION_HEIGHT_PAL; } RegionInfo.dwTAddr = DS_OSDFRAME_ST; OSD_SetRegion(0, FALSE, &RegionInfo);#else#ifdef BORROW_FRAME_BUFFER GDI_ClearRegion(0); //Alan2.30, fix mantis bug #1886 if (_DLG_FrameAttr.rect.wRight - _DLG_FrameAttr.rect.wLeft <= __RegionList[0].wWidth && _DLG_FrameAttr.rect.wBottom - _DLG_FrameAttr.rect.wTop <= __RegionList[0].wHeight && GDI_OSD_8B_MODE == __RegionList[0].bColorMode) { // Use OSD buffer and Frame buffer 0 RegionInfo.dwTAddr = DS_OSDFRAME_ST; } else { // Use Frame buffer 1 or 2 dwBufferAddr = DISP_QueryAvailableBuffer(); if (0 == dwBufferAddr) { RegionInfo.dwTAddr = DS_OSDFRAME_ST; printf("DISP can't find an available buffer for OSD region\n");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -